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

Commit 009112c

Browse files
authored
Feature/slimmer docker image (#1)
* only download production dependencies for Docker image * update Dockerfile: place app to /home/node/app
1 parent b47b68f commit 009112c

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
.angular/cache/
22
.circleci/
33
node_modules/
4+
dist/
45
.idea/
56
.git/
67
reports/

Dockerfile

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,21 @@
1-
FROM node:16-alpine
1+
FROM node:16-alpine as base
22

33
USER node:node
4-
WORKDIR /home/node
4+
RUN mkdir /home/node/app
5+
RUN chown node:node /home/node/app
6+
WORKDIR /home/node/app
57

68
COPY --chown=node ./package*.json ./
7-
ARG INSTALL_ARGS="--no-fund --no-audit"
9+
ARG INSTALL_ARGS="--production --no-fund --no-audit"
810
RUN npm clean-install $INSTALL_ARGS
911

12+
FROM base as build
13+
ARG INSTALL_DEV_ARGS="--no-fund --no-audit"
14+
RUN npm install $INSTALL_DEV_ARGS
1015
COPY --chown=node ./ ./
1116
RUN npm run build:ssr
1217

18+
FROM base as app
19+
COPY --from=build --chown=node /home/node/app/dist ./dist
1320
EXPOSE 4000
1421
ENTRYPOINT npm run serve:ssr

0 commit comments

Comments
 (0)