3 ms·
Our node docker images are 600-1000 MB for relatively simple website (backend and frontend). 25 MB would be so good and lightweight.
by vbezhenar 4y ago
Our node docker images are 600-1000 MB for relatively simple website (backend and frontend). 25 MB would be so good and lightweight.
- interblag 4y agoUnless I'm massively misunderstanding your setup, that Docker image contains an entire OS and runtime, not just your website. Reasonable people can disagree about whether that entire paradigm is sensible but, having chosen to use Docker, complaining about image size in this way seems an odd choice. More to this point, most of what is in the image will be little to do with Node or its build systems..
- toomanybeersies 4y agoThe NodeJS alpine base image is only 40 MB.
- lolive 4y agoThen you _npm install_ something, and BOOOM! 600MB !
- Defman 4y agoYou can use multi-stage builds [1] so your result image would be as small as possible by just copying the compiled JS from the build stage. [1]: https://docs.docker.com/develop/develop-images/multistage-build/ https://docs.docker.com/develop/develop-images/multistage-bu...
- vbezhenar 4y agoYou still need to download hundreds of megabytes of packages, unpack those into gigabyte of storage, "compile" it into a final form. Also you need to keep those huge images, if you want to have any reasonable caching. Otherwise builds will take forever.
- hinkley 4y agoCompiled JavaScript?
- Tajnymag 4y agoThat sounds like you are bundling the whole node_modules directory. Have you looked into Alpine based images and vendoring js dependencies into a bundle? 1 GB seems too large even for nodejs.