Skip to content
This repository has been archived by the owner on Sep 30, 2022. It is now read-only.

Commit

Permalink
Use multistage build in Dockerfile for decreasing image size.
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-danilenko committed Mar 18, 2022
1 parent d5f422b commit 5d2a29b
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions Dockerfile
@@ -1,14 +1,15 @@
FROM node:16-alpine
FROM node:16-alpine as build

WORKDIR /app

# Install dependencies.
COPY package.json yarn.lock /app/
# Use lockfile for being sure everything is compatible.
RUN yarn install --frozen-lockfile
# Copy project code.
COPY . .
# Build an app.
RUN yarn build

FROM node:16-alpine
WORKDIR /app
COPY package.json yarn.lock /app/
COPY --from=build /app/dist /app/dist
RUN yarn install --frozen-lockfile --production

ENTRYPOINT ["yarn", "start:prod"]

0 comments on commit 5d2a29b

Please sign in to comment.