I was looking into some of this myself already; really helpful article and amazing results. Another interesting approach is to compile Haskell with HaLVM[1] in to a unikernel that can run on a Xen hypervisor. But this is a non-posix environment on which Haskell's "network" package does not compile. No "network" means that it is currently impossible[2] for WAI (Haskell's standard interface between web servers and applications), but also db libraries, to run in such an environment.<p>With going unikernel with Haskell still being a little steep (but definitely on my wish list), then the next-best would be a mini VM/container image. And 5MB sure is mini!<p>Once again, thanks FPComplete!<p>1: <a href="https://github.com/GaloisInc/HaLVM" rel="nofollow">https://github.com/GaloisInc/HaLVM</a><p>2: <a href="https://github.com/GaloisInc/HaLVM/issues/43" rel="nofollow">https://github.com/GaloisInc/HaLVM/issues/43</a>
I was once fascinated by tiny docker images and wanted to have a tiny docker image with a web server.<p>There was a go web server I dockerized and came under 5MB [1]. But the thttpd image by larsks was an amazing 1MB [2].<p>[1] <a href="https://registry.hub.docker.com/u/chanux/muhttpd/" rel="nofollow">https://registry.hub.docker.com/u/chanux/muhttpd/</a><p>[2] <a href="https://registry.hub.docker.com/u/larsks/thttpd/" rel="nofollow">https://registry.hub.docker.com/u/larsks/thttpd/</a>
I use the same technique of bundling the necessary dynamic libraries and gconv files for the git-annex standalone tarball distribution. I've observed users untarring that onto arbitrary wacky NAS boxes and it just working, which is pretty nice.<p>I later adapted that for use in propellor too, when it's deploying docker/etc containers. This allows propellor to bootstrap itself to run inside an arbitrary docker container. <a href="http://joeyh.name/blog/entry/propelling_containers/" rel="nofollow">http://joeyh.name/blog/entry/propelling_containers/</a><p>Later, I used propellor's ability to bootstrap itself this way to let it copy itself onto a VM and run there to replace its content with a clean reinstall of Debian. <a href="http://joeyh.name/blog/entry/clean_OS_reinstalls_with_propellor/" rel="nofollow">http://joeyh.name/blog/entry/clean_OS_reinstalls_with_propel...</a>
Oh I was following the same path and was mising a library or two. The result is similar to Michael's scratch image: <a href="https://gist.github.com/noteed/4155ffad2b1d13ab17ee" rel="nofollow">https://gist.github.com/noteed/4155ffad2b1d13ab17ee</a><p>The resulting image for "hello world" compressed with `xz` (default options) is 1.5MB. And it runs in a chroot or with qemu too.