Skip to content

Instantly share code, notes, and snippets.

@vschoener
Created December 18, 2018 22:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vschoener/6654fc17a694b90fa60eb5eeac4d52f5 to your computer and use it in GitHub Desktop.
Save vschoener/6654fc17a694b90fa60eb5eeac4d52f5 to your computer and use it in GitHub Desktop.
FROM node:11.4 as base
WORKDIR /app
# use changes to package.json to force Docker not to use the cache
# when we change our application's nodejs dependencies:
COPY package*.json /tmp/
RUN cd /tmp && npm install --quiet
RUN cp -r /tmp/node_modules /app
# From here we load our application's code in, therefore the previous docker
# "layer" thats been cached will be used if possible
COPY . /app
CMD [ "npm", "start" ]
# If deployment / testing are used, we could also use other build stages
# We can also use a stage to add our tools if we don't want them in the devDepencies (cf apiDoc for ex.)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment