Open utterances-bot opened 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 !
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.
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/