https://github.com/bromaniac/smolest
https://github.com/bromaniac/smolest
docker experiment rust toy unlicense web
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/bromaniac/smolest
- Owner: bromaniac
- License: unlicense
- Created: 2024-01-12T11:58:17.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-02-21T19:08:51.000Z (over 1 year ago)
- Last Synced: 2025-02-21T20:22:07.055Z (over 1 year ago)
- Topics: docker, experiment, rust, toy, unlicense, web
- Language: Rust
- Homepage:
- Size: 9.77 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
This was created for a fun challenge from a colleague:
Create the smallest possible Docker image for a web application written in Rust that:
Replies HTTP 200 for /
Replies HTTP 200 "OK" for /health
I couldn't get cross compilation to work so build this in an Alpine container:
docker run --rm -it -v .:/mnt alpine sh
All deps needed are in the alpine.sh script, so run that:
$ sh alpine.sh
Build command:
RUSTFLAGS="-Zlocation-detail=none" cargo +nightly build -Z build-std=std,panic_abort -Z build-std-features=panic_immediate_abort --target x86_64-unknown-linux-gnu --release
Then build the Docker image on any system:
docker build -t smolest .
Run it:
docker run --rm -it --init -p 8000:8000 smolest
To make this even smaller probably involves using no_std... good luck!