Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker: use multi-stage build to reduce size #6938

Merged
merged 2 commits into from
Aug 25, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:14-alpine
FROM node:14-alpine AS Builder

RUN mkdir -p /usr/src/app
RUN mkdir /usr/src/app/private
Expand All @@ -17,9 +17,14 @@ RUN npm run build
RUN npm prune --production
RUN npm cache clean --force

# Use multi-stage build to reduce size
FROM node:14-alpine
# Run the server using production configs.
ENV NODE_ENV production

WORKDIR /usr/src/app
COPY --from=Builder /usr/src/app /usr/src/app

CMD node server

EXPOSE 80