Skip to content
This repository was archived by the owner on Oct 2, 2024. It is now read-only.

Commit b111064

Browse files
fix: Dockerfile to use multi-stage build (#121)
1 parent e295177 commit b111064

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

Dockerfile

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,25 @@
11
ARG NODE_VERSION=20
2-
3-
FROM node:${NODE_VERSION}
4-
LABEL org.opencontainers.image.source https://github.com/eddiehubcommunity/CreatorsRegistry
2+
FROM node:${NODE_VERSION} as builder
53

64
WORKDIR /usr/src/app
75

8-
COPY . .
6+
COPY package*.json ./
97

108
RUN npm ci
119

10+
COPY . .
11+
12+
RUN npx prisma generate
13+
RUN npm run build
14+
15+
# Production image, copy all the files and run next
16+
FROM node:${NODE_VERSION} as production
17+
LABEL org.opencontainers.image.source https://github.com/eddiehubcommunity/CreatorsRegistry
18+
19+
WORKDIR /usr/src/app
20+
21+
COPY --from=builder /usr/src/app .
22+
1223
EXPOSE 3000
1324

14-
CMD npm run db:prod:migrate && npm run build && npm run start
25+
CMD npm run db:prod:migrate && npm run start

0 commit comments

Comments
 (0)