nodejs / docker-node

Official Docker Image for Node.js :whale: :turtle: :rocket:
https://hub.docker.com/_/node/
MIT License
8.28k stars 1.97k forks source link

docs(BestPractices.md): add dependency caching guide #1101

Open yxliang01 opened 5 years ago

yxliang01 commented 5 years ago

To avoid performing npm install again and again when any source code in the project is being modified, it's (always?) preferred to cached node_modules as long as package.json and package-lock.json are not changed. I think this can be added to the BestPractices.md guide. Welcome for discussions on whether this is really a good practice also.

yosifkit commented 5 years ago

That is what the deprecated onbuild images would do. Perhaps it needs to be dropped into the best practices doc (minus the ONBUILD keyword)?

Or just update the Dockerfile in the how-to-use this image section, since that two line Dockerfile doesn't really containerize an app unless it has a COPY.