Skip to content

Commit

Permalink
split build dependencies into multiple steps for better caching in do…
Browse files Browse the repository at this point in the history
…ckerfile
  • Loading branch information
DavidSingh3 authored Oct 9, 2019
1 parent ecbe7a9 commit dec6ca2
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions DOCKERFILES.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,15 @@ CMD ["serve", "-l", "80", "-s", "."]
### node server
```Dockerfile
FROM node:dubnium-alpine
# pick a version from https://hub.docker.com/_/node/
FROM node:alpine
# add tini to handle signals and zombie process reaping
RUN apk add --no-cache tini
ENTRYPOINT ["/sbin/tini", "--"]
WORKDIR /server
COPY package*.json ./
# install build dependencies to generate any required binaries
# https://github.com/nodejs/docker-node/issues/282
# --no-cache: download package index on-the-fly, no need to cleanup afterwards
Expand All @@ -54,9 +53,10 @@ RUN apk --no-cache --virtual build-dependencies add \
python \
make \
g++ \
git \
&& npm install --prod \
&& apk del build-dependencies
git
COPY package*.json ./
RUN npm install --prod
RUN apk del build-dependencies
COPY src/ ./
Expand Down

0 comments on commit dec6ca2

Please sign in to comment.