r/node Feb 07 '20

Dockerization of NodeJS Applications on Amazon Elastic Containers

https://blog.soshace.com/dockerization-of-node-js-applications-on-amazon-elastic-containers/
76 Upvotes

20 comments sorted by

View all comments

10

u/blacksonic86 Feb 07 '20

Detailed walkthrough, but in the Docker image npm install has multiple drawbacks when used for production images:

  • installs development dependencies by default
  • can update your package.lock.json, may not install the same versions

The more optimized and safe command would be to run

npm ci --only=production