Repository navigation
refactor(docker): convert thulp image to cargo-chef multi-stage - #20
Merged
Merged
Conversation
…pattern Mirrors /opt/eruka/Dockerfile: chef/planner/builder/runtime stages with --mount=type=cache for the cargo registry/git/target dirs. Dependencies are cooked from a manifest-only recipe, so source edits no longer invalidate the dependency layer. Repo-specific bits preserved: workspace build context (COPY . ...), the --bin thulp build, the runtime user/ENTRYPOINT/LABELs, and the RUST_IMAGE/ RUNTIME_IMAGE ARGs. protobuf-compiler added to the builder because the rs-utcp dependency compiles gRPC protos at build time and the plain rust:1.91-slim image has no protoc.
bkataru
force-pushed
the
docker/cargo-chef
branch
from
October 14, 2026 06:28
e15d513 to
9945146
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rationale
The estate-wide CI speedup (runner-side: baked toolchains, sccache per-repo volumes, pooled runners) is done; this is the image-build half. The previous Dockerfile was a plain two-stage build with no dependency caching: every source edit recompiled the entire workspace dependency graph from scratch.
This converts the Dockerfile to the same cargo-chef multi-stage pattern used by the eruka reference image: a
chefstage installs cargo-chef, aplannerstage captures a manifest-onlyrecipe.json, abuilderstage cooks dependencies from that recipe (cached independently of source), and only then copies the real sources for the finalcargo build --release --bin thulp.What changed
chef+plannerstages;buildernow cooks fromrecipe.jsonbefore compiling the workspace.--mount=type=cache) so cooked deps persist between the two builder steps and across builds.protobuf-compilerto the builder: thers-utcpdependency compiles gRPC protos at build time and the plainrust:1.91-slimimage has noprotoc(this was the only thing missing for a clean build).--bin thulp, runtime user /ENTRYPOINT/CMD,LABELs, and theRUST_IMAGE/RUNTIME_IMAGEARGs.Verification
Built with a throwaway tag (
docker build -t thulp-chef-check .— BuildKit, Docker 29.8.2) from a fresh clone; the image built successfully anddocker run --rm thulp-chef-check --helpprints the thulp CLI banner. The tag has been deleted.