On the contrary. It'll reduce the number of layers. The builder image is an intermediary image and will not be part of the final image. The bottom part of the Dockerfile is where you create a fresh image and copy over the node_modules. In doing so drastically reducing the number of layers, and excluding build dependencies.
Senior DevOps Engineer with 8.5+ years of experience. Otherwise an avid artist, reader, cinephile & football fan. Looking forward to connecting with everyone :)
Thanks for the explanation that builder images are intermediate and not a part of the final one.
While I'll surely dabble with it myself for better clarity, from your experience so far - is this reduction possible for only Node apps or can be replicated for virtually any application?
On the contrary. It'll reduce the number of layers. The builder image is an intermediary image and will not be part of the final image. The bottom part of the Dockerfile is where you create a fresh image and copy over the
node_modules
. In doing so drastically reducing the number of layers, and excluding build dependencies.Thanks for the explanation that builder images are intermediate and not a part of the final one.
While I'll surely dabble with it myself for better clarity, from your experience so far - is this reduction possible for only Node apps or can be replicated for virtually any application?
It has nothing to do with the programming language or runtime. It solely has to do with the way you structure and build your images.