Deploy & Infra
Rust Docker Pipeline — cargo-chef
Build and ship Rust in Docker fast, with cargo-chef layer caching.
A focused lesson in fast, cache-friendly Rust container builds, around a tiny axum app. cargo-chef caches the dependency layer so a code change doesn't recompile the world, and an export stage writes the binary out so a server too small to compile Rust can run a prebuilt one. Two compose files show both paths.
What's inside
- cargo-chef dependency-layer caching
- From-source and precompiled build paths
- Multi-stage Dockerfile with a binary export stage
- A compose file per variant
- Distroless, non-root final image
Quickstart
$ git clone https://github.com/devai-io/devai_boilerplates.git$ cd devai_boilerplates/rust-docker-pipeline$ docker compose up --build # then open http://localhost:8080
about this series
One of the devai.io advanced Rust boilerplates — the Docker build pipeline that keeps Rust image builds quick, brought up to date.