ganeshmani / cloudnweb-comments

This Repo is a comment section for my blog cloudnweb.dev
0 stars 0 forks source link

Crafting multi-stage builds with Docker in Node.js #5

Open utterances-bot opened 3 years ago

utterances-bot commented 3 years ago

Crafting multi-stage builds with Docker in Node.js

Docker has became an inevitable tool for development. Everyday developers face new challenges for containerizing their applications.One of the important problems are containerizing the application for different enviroments

https://cloudnweb.dev/2019/10/crafting-multi-stage-builds-with-docker-in-node-js/

younes-io commented 3 years ago

Hello, In the final stage you run npm install. Why haven't you copied the node_modules folder generated during the build stage ? Thank you !

daveteu commented 2 years ago

The point of multi build is to install the modules on the first stage, so you do not need to download the node_modules again (unless you change your package.json).

Hence, shouldn't npm install in stage 0, and npm run build be moved in to stage 1? Since your codes in src will likely change, you will end up building your docker from stage 1 since stage 0 will be serve from your cache.