Skip to content

docker: enable sccache (redis) in the Rust image builds (JEF-84)#230

Merged
thejefflarson merged 3 commits into
mainfrom
sccache-image-builds
Jul 12, 2026
Merged

docker: enable sccache (redis) in the Rust image builds (JEF-84)#230
thejefflarson merged 3 commits into
mainfrom
sccache-image-builds

Conversation

@thejefflarson

Copy link
Copy Markdown
Owner

Wire both Rust image builds into the shared in-cluster sccache Redis (sccache-redis.dev.svc.cluster.local:6379), now that BuildKit is meshed and can reach it. Mirrors the proven pattern just merged in metrics.

Changes

  • Dockerfile (engine): cargo-chef REMOVED. Collapsed the chef/planner/builder split into a single builder stage (COPY . . + one cargo build). sccache + cargo-chef's cook fight over the shared /app/target dir and abort on .rmeta hashing (JEF-389). Base swapped from the cargo-chef image to mirror.gcr.io/library/rust:1-bookworm. The node/web dashboard stage, cmake, CFLAGS=gnu17, cache-mount IDs, and the slim runtime stage are all preserved.
  • agent/Dockerfile: already a plain cargo build (no cargo-chef) — just added the sccache install block and wrapped the build RUN. eBPF/bpf-linker/nightly setup untouched.

Notes

  • Both bases are Debian bookworm (glibc), not musl. mozilla/sccache ships no x86_64/aarch64 linux-gnu build, so both use the static musl sccache 0.16.0 binary (arch-aware uname -m selection) — it runs fine on glibc.
  • sccache is a HARD GATE (no local fallback); CARGO_INCREMENTAL=0; each build exports a unique random SCCACHE_SERVER_PORT to dodge the shared-netns fixed-port-4226 collision on concurrent matrix builds.
  • Not merging; CI not triggered here.

🤖 Generated with Claude Code

thejefflarson and others added 2 commits July 12, 2026 10:12
Wire both Rust image builds into the shared in-cluster sccache Redis
(sccache-redis.dev.svc.cluster.local:6379), now that BuildKit is meshed
and can reach it.

- Dockerfile (engine): REMOVE cargo-chef and collapse to a single builder
  stage (COPY . . + one `cargo build`). sccache + cargo-chef's `cook` fight
  over the shared target dir and abort on `.rmeta` hashing (JEF-389). The
  node/web dashboard stage, cmake, CFLAGS=gnu17, cache mounts, and runtime
  stage are unchanged.
- agent/Dockerfile: already a plain `cargo build`, so just add the sccache
  install + wrap the build (nothing to remove).

Both use the static musl sccache 0.16.0 binary (arch-aware; mozilla/sccache
ships no x86_64/aarch64 linux-gnu build — it runs fine on the glibc base).
sccache is a HARD GATE (no fallback), CARGO_INCREMENTAL=0, and each build
picks a unique random SCCACHE_SERVER_PORT to avoid the shared-netns port
4226 collision on concurrent matrix builds.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013cYVqzH7Xfwea7fAozdQK7
… gate on deploy build)

The e2e job runs on ubuntu-latest and does a plain docker build of this Dockerfile, which can
never reach the in-cluster sccache-redis — so the redis HARD GATE (timeout 10 sccache --start-server)
always trips there (exit 124). Add an ARG SCCACHE_DISABLE (default empty => hard gate stays on for
the real deploy build on the meshed BuildKit); scripts/e2e.sh passes --build-arg SCCACHE_DISABLE=1
to build plain/uncached instead of failing. No mesh, no fail-soft on the deploy path.
@thejefflarson thejefflarson force-pushed the sccache-image-builds branch from 9c34acb to 5a43d86 Compare July 12, 2026 18:26
@thejefflarson thejefflarson enabled auto-merge (squash) July 12, 2026 18:42
@thejefflarson thejefflarson merged commit 3c30088 into main Jul 12, 2026
7 checks passed
@thejefflarson thejefflarson deleted the sccache-image-builds branch July 12, 2026 18:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant