Salut!           I'm a Ruby/Rust/Crystal developer with a devops background and leadership experience.           You can also find me here:

The smallest Docker image to serve static websites | Florin Lipan

submited by
Style Pass
2024-02-27 15:30:02

Salut! I'm a Ruby/Rust/Crystal developer with a devops background and leadership experience. You can also find me here: GitHub / Twitter / LinkedIn / Email.

Until recently, I used to think that serving static websites from Docker would be a waste of bandwith and storage. Bundling nginx or various other heavy runtimes inside a Docker image for the sole purpose of serving static files didn’t seem like the best idea - Netlify or Github Pages can handle this much better. But my hobby server was sad and cried digital tears.

A recent HackerNews post about redbean, a single-binary, super tiny, static file server got me thinking. So begins my journey to find the most time/storage efficient Docker image to serve a static website.

After evaluating a few static file servers with similar specs, I initially opted for thttpd, which comes with a similar small footprint but seems a bit more battle-tested. This got me to a whooping 186KB image and you can read more about it in the previous version of this post.

Leave a Comment