You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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.
It would probably require extensive documentation to cover best practices for different package managers including the commonly-used npm, Yarn Classic, Yarn Modern (also with Plug'n'Play) and pnpm.
Caching node_modules can lead to issues when post-installation scripts are associated with npm modules, and these are not executed if the module is found to be pre-installed. This can lead to malfunction.
Activity
yosifkit commentedon Aug 28, 2019
That is what the deprecated
onbuildimages would do. Perhaps it needs to be dropped into the best practices doc (minus theONBUILDkeyword)?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.MikeMcC399 commentedon May 5, 2026
It would probably require extensive documentation to cover best practices for different package managers including the commonly-used npm, Yarn Classic, Yarn Modern (also with Plug'n'Play) and pnpm.
Caching
node_modulescan lead to issues when post-installation scripts are associated with npm modules, and these are not executed if the module is found to be pre-installed. This can lead to malfunction.Leaving open as a general suggestion.