We reduced a real Node.js production Docker image from 1.2GB to 78MB
the-practical-developer.online
the-practical-developer.online
https://sandeepbansod.medium.com/why-your-docker-container-i...
Switching to debian reduced it to microseconds.
Does anyone here know what I was doing wrong with alpine?
Too many weird edge cases to deal with, especially related to Alpine using musl libc instead of glibc.
At best, your builds are slower.
At worst, certain code paths are broken.
99 times out of 100 it’s a terrible choice for an enterprise.
Golang gives you a web server as a staticly linked binary.
If the question is "I need to containerize my Node app, how do I make it small?" the answer can't be "don't containerize it and don't use Node".
On M1 launching the docker containers lagged the entire system.
Trying to mount a volume caused issues. (known issue) The official web app advertisies it as multiplatform which it's not.
Anything more complex than hello world become a nightmare on Docker. PM2 as process manager and simple bash scripts demolish Docker which sounds too good in theory but is half-baked in practice.
Just use Linux, and "containers" are a subprocess and bind mount.
Mostly /s