Simple web programming.
Frustrated with modern web development worst practices?
Sick of Evil Corp.™ 'services'?
Interested in scaling down to a personal, hackable web?
Have fun with CGI!
A number of programming environments are ready to go:
Flavor | Description | Size (MB) |
---|---|---|
base | barebones BusyBox environment | 5.73 |
Forth | the stack based programming language | 8.36 |
Guile | scheme dialect / GNU extension language | 18.9 |
Jim | small-footprint yet full-featured Tcl dialect | 10.1 |
Lua | lightweight, embeddable scripting language | 6.09 |
OCaml | an industrial strength programming language | 202 |
Perl | 25,000 extensions on CPAN | 39.9 |
Python | popular and easy-to-learn | 58.6 |
Ruby | 'Ruby is designed to make programmers happy' | 24.3 |
Tcl | Tool Command Language, batteries included | 15.2 |
$ mkdir -p www/cgi-bin
$ echo '#!/bin/sh' > www/cgi-bin/shell
$ echo 'echo "content-type: text/plain"' >> www/cgi-bin/shell
$ echo 'echo ""' >> www/cgi-bin/shell
$ echo 'echo "Hello, World!"' >> www/cgi-bin/shell
$ echo 'echo "$QUERY_STRING"' >> www/cgi-bin/shell
$ docker run --name funcgi \
--user 4000 \
--security-opt=no-new-privileges \
--cap-drop ALL \
--read-only \
--tmpfs /tmp \
--volume "$(pwd)"/www:/var/www/localhost/htdocs \
--publish 80:1337 tlcu/funcgi:base
$ curl localhost/cgi-bin/shell
Hello, World!
$ curl localhost/cgi-bin/shell?hi!
Hello, World!
hi!
The following commands will build and launch a container locally:
$ git clone https://github.com/tlcu/funcgi
$ cd funcgi
$ docker build <flavor> -t funcgi:<flavor>
$ ./run.sh <flavor>
Navigating to http://localhost
should bring up the demo web page.
$ curl localhost/cgi-bin/test
should get you a response from the
demo shell CGI script.
From here, you can edit and file to the www
directory.
Executables should go in www/cgi-bin/
, static content can
go anywhere else.
- Alpine Linux base
- mini_httpd webserver
The docker run
commands try to constrain the CGI programs:
they are ran by an unprivileged user in a read-only filesystem.