- Rust 71.5%
- Dockerfile 28.5%
| .forgejo/workflows | ||
| src | ||
| Cargo.toml | ||
| Dockerfile | ||
| Dockerfile.mimalloc | ||
| LICENSE | ||
| README.md | ||
teletraan
a static binary-based rootless dockerized web server that is so small, it is effectively braindead, while remaining featureful for most usecases.
the server can run rootless, read-only, and distroless, making it lighter and more secure than nginx. it serves everything in the /data folder
inspired by busybox httpd.
in less than 150 loc, it currently supports:
- gzipped files
- serving single page webapps like cinny nginx-style via the
-sflag - serving formats other than html as the index with the
-iflag.
it has extremely minimal dependencies, so minimal that you can tack on a crapload of compilation options and use nightly rust without harming binary functionality.
it is compiled with panic=immediate-abort.
flavors
the official docker image comes in two flavors, latest and mimalloc.
the latest one uses a basic rust alpine container to build teletraan, thus using alpine's default allocator. this allocator has a history of performance issues; albeit for a basic web server it may be suitable for most use cases.
the mimalloc one uses chimera for the build stage, which is a musl distro based on the llvm toolchain and which patches the musl libc to use mimalloc, a performance-based allocator made by microsoft, as default allocator. this means that the binary here uses the mimalloc allocator during runtime, which fixes performance issues but is less secure. regardless, it shouldnt matter much if you run teletraan read-only.
example usage
compose file
in a compose file, you can use teletraan to run your static site stack:
services:
site-with-index.txt:
image: codeberg.org/gigirassy/teletraan:latest
read_only: true
volumes:
- "./site:/data"
command: "-i" # site made of txt files
ports:
- "127.0.0.1:9900:3000"
spa-matrix-client:
image: codeberg.org/gigirassy/teletraan:latest
read_only: true
volumes:
- "./cinny:/data"
command: "-s" # single page app
ports:
- "127.0.0.1:9901:3000"
basic-html-site:
image: codeberg.org/gigirassy/teletraan:latest
read_only: true
volumes:
- "./basic-html-site:/data"
# no command: flags needed!
ports:
- "127.0.0.1:9904:3000"
use external caddy or nginx to reverse proxy the host ports either way.
dockerfile
an image of cinny can be easily and quickly built with teletraan as the server. we just need to specify CMD ["-s"] at the end.
FROM ghcr.io/cinnyapp/cinny:v4.12.3 AS source
FROM codeberg.org/gigirassy/teletraan:latest AS runtime
COPY --from=source /usr/share/nginx/html .
EXPOSE 3000
CMD ["-s"]
a simple image for your static site can be built easily. you dont have to specify a cmd!
FROM codeberg.org/gigirassy/teletraan:latest
COPY /static .
EXPOSE 3000
if your static site is made of txt files, use the CMD ["-i"] flag to serve your index.txt file in the webroot as the index.
FROM codeberg.org/gigirassy/teletraan:latest
COPY /doc .
EXPOSE 3000
CMD ["-i"]
use external caddy or nginx to reverse proxy the host ports either way.
license
ISC