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

Commit

Permalink
fix: Dockerfile to use multi-stage build (#121)
Browse files Browse the repository at this point in the history
  • Loading branch information
the-mzakrzewski authored Jul 13, 2024
1 parent e295177 commit b111064
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,25 @@
ARG NODE_VERSION=20

FROM node:${NODE_VERSION}
LABEL org.opencontainers.image.source https://github.com/eddiehubcommunity/CreatorsRegistry
FROM node:${NODE_VERSION} as builder

WORKDIR /usr/src/app

COPY . .
COPY package*.json ./

RUN npm ci

COPY . .

RUN npx prisma generate
RUN npm run build

# Production image, copy all the files and run next
FROM node:${NODE_VERSION} as production
LABEL org.opencontainers.image.source https://github.com/eddiehubcommunity/CreatorsRegistry

WORKDIR /usr/src/app

COPY --from=builder /usr/src/app .

EXPOSE 3000

CMD npm run db:prod:migrate && npm run build && npm run start
CMD npm run db:prod:migrate && npm run start

0 comments on commit b111064

Please sign in to comment.