3 ms·
I've recently needed to build a docker image to run a static site. I compiled busybox with only it's httpd server. It runs with 300kb of ram with a scratch imag
by nullify88 3y ago
I've recently needed to build a docker image to run a static site. I compiled busybox with only it's httpd server. It runs with 300kb of ram with a scratch image and tini.
I didn't compile in fastcgi support in to my build, but it can be enabled.
- synergy20 3y agoyes busybox httpd or civetweb is even smaller, both around 300kb. for tini you mean https://github.com/krallin/tini https://github.com/krallin/tini? how large is your final docker image, why not just alpine in that case which is musl+busybox
- nullify88 3y agoYep that tini. The docker image is about 1.90mb. It's a repack of https://homer-demo.netlify.app/ https://homer-demo.netlify.app/ I pre-gzipped a few of the compressible file extensions too so they can be served compressed. In this case, I didn't need alpine. I generally aim to get the image as minimal as possible without too much hassle. I end up doing stuff like this alot when I feel like a community image maybe too bloated when something like alpine or distroless can be used. Entry point scripts have all kinds of envars and a shell dependency, I'd rather rebuild the image to cater for my needs and execute the binary directly, and mount in any config via k8s.