Skip to content

Instantly share code, notes, and snippets.

@parshap
Created February 9, 2015 18:40
Show Gist options
  • Save parshap/aae5d6fcdae84a25d402 to your computer and use it in GitHub Desktop.
Save parshap/aae5d6fcdae84a25d402 to your computer and use it in GitHub Desktop.
Caching npm install with Docker
FROM nodesource/node:trusty
EXPOSE 8080
WORKDIR /src
# Install dependencies
# See http://www.clock.co.uk/blog/a-guide-on-how-to-cache-npm-install-with-docker
ADD package.json /src/package.json
RUN npm install
ADD . /src
# Run npm install again in case a package.json change was not picked up by
# Docker.
RUN npm install
CMD [ "npm", "start" ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment