Is copying /node_modules inside a Docker image not a good idea? Is copying /node_modules inside a Docker image not a good idea? docker docker

Is copying /node_modules inside a Docker image not a good idea?


Public Dockerfiles out there are trying to provide generalized solution.Having dependencies coded in package.json makes it possible to share only one Dockerfile and not depend on anything not public available.

But at runtime Docker does not care how files got to container. So this is up to you, how you push all needed files to your container.

P.S. Consider layering. If you copy stuff under node_modules/, do it in one step, by that only one layer is used.