Skip to content

Instantly share code, notes, and snippets.

@robwilde
Forked from dweinstein/Dockerfile-nodejs
Created June 23, 2019 06:48
Show Gist options
  • Save robwilde/c9b6b7873af081a8d8f4992e0bc30c45 to your computer and use it in GitHub Desktop.
Save robwilde/c9b6b7873af081a8d8f4992e0bc30c45 to your computer and use it in GitHub Desktop.
Install node modules before copying over your working code so that node_modules are built (and cached) before you change your service code!
# ...
ADD package.json /tmp/package.json
RUN cd /tmp && npm install && \
mkdir -p /opt/app && cp -a /tmp/node_modules /opt/app/
# ...
WORKDIR /opt/app
ADD . /opt/app
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment