Redbean - single-file distributable web server
-
redbean
single-file distributable web server
redbean is an open source webserver in a zip executable that runs on six operating systems. The basic idea is if you want to build a web app that runs anywhere, then you download the redbean.com file, put your .html and .lua files inside it using the zip command, and then you've got a hermetic app you can deploy and share.
redbean embeds Lua, SQLite, and MbedTLS into a fork() driven application server that benchmarks at 1.1 million qps on a personal computer. It's got a live bestline REPL with code completion and a UNIX module too, that lets you directly use the Cosmopolitan Libc system call interface. redbean furthermore provides sandboxing and system call tracing for security. This makes redbean a great fit for when you want to build an app that's vertically integrated into a single tiny file that runs on nearly all PCs and servers.
Others have been taking this excellence to great heights:
https://github.com/kissgyorgy/redbean-docker
The smallest possible web server in Docker!
Built from Redbean: https://redbean.dev/, a single-file distributable web server.The final container takes only 501 kB:
$ docker images redbean-static REPOSITORY TAG IMAGE ID CREATED SIZE redbean-static latest 814da89a2fa7 16 minutes ago 501 kB
or just 186 kB if you use the tinylinux version of Redbean:
$ docker images redbean-tinylinux REPOSITORY TAG IMAGE ID CREATED SIZE redbean-tinylinux latest 0b98596e96d8 2 seconds ago 186 kB
Examples
There are a couple of example Dockerfiles in this repo if you want to build it yourself:
- Dockerfile-multistage of how to produce a container from "scratch"
- Dockerfile-tinylinux for the world record small version
- Dockerfile-onbuild if you just want a scratch container