Skip to content

Commit

Permalink
chore: docker split builder and runner
Browse files Browse the repository at this point in the history
  • Loading branch information
YuJianghao committed May 22, 2022
1 parent 96026fc commit 501320f
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
FROM node:16-alpine
FROM node:16-alpine as builder

WORKDIR /app

COPY . .

RUN npm install -g pnpm

RUN pnpm install --frozen-lockfile

RUN npm run build

EXPOSE 3000
FROM node:16-alpine as runner

WORKDIR /app
ENV NODE_ENV production
COPY . .
RUN npm install -g pnpm
RUN pnpm install --frozen-lockfile -P
COPY --from=builder /app/dist ./dist

EXPOSE 3000
CMD ["npm", "start"]

0 comments on commit 501320f

Please sign in to comment.