Skip to content

ci: native per-platform Docker builds with cargo-chef and registry cache#144

Merged
digizeph merged 1 commit into
mainfrom
ci/native-docker-builds
Jul 21, 2026
Merged

ci: native per-platform Docker builds with cargo-chef and registry cache#144
digizeph merged 1 commit into
mainfrom
ci/native-docker-builds

Conversation

@digizeph

Copy link
Copy Markdown
Member

Summary

  • Replaced QEMU-emulated multi-platform Docker build with native per-platform builds on AMD64 and ARM64 runners
  • Added cargo-chef to Dockerfile for dependency-layer caching
  • Switched BuildKit cache from GHA to registry-based cache

Changes

.github/workflows/docker.yml

  • Split single QEMU job into a two-entry matrix:
    • linux/amd64 on ubuntu-latest
    • linux/arm64 on ubuntu-24.04-arm (native ARM runner)
  • Each build pushes an untagged image by digest
  • Added merge job that assembles a multi-architecture OCI image index via docker buildx imagetools create
  • Per-platform registry cache (bgpkit/monocle:buildcache-{arch})

Dockerfile

  • Three-stage cargo-chef pattern: chefplannerbuilder
  • Dependencies compiled from recipe (cargo chef cook) in a cacheable layer separate from application source
  • RUN --mount=type=cache for Cargo registry

CHANGELOG.md

  • Added Build & Infrastructure section

Expected impact

Metric Before After (expected)
ARM64 build ~54 min (QEMU emulation) native compile time
Source-only changes Full dependency recompile Only application crate recompiled
Cache budget 10 GB GHA limit Unlimited (registry)

Verification

  • Local Docker build succeeded; binary reports monocle 1.3.0
  • actionlint passes
  • docker buildx build --check passes (no warnings)
  • Repeated local build confirmed all layers cached

Replace QEMU-emulated multi-platform build with native per-platform builds:
- linux/amd64 on ubuntu-latest
- linux/arm64 on ubuntu-24.04-arm (native ARM runner)
Each build pushes by digest; a manifest-merge job assembles the final
multi-architecture OCI image index with the standard tags.

Add cargo-chef to Dockerfile for dependency-layer caching: source-only
changes now reuse the pre-compiled dependency layer.

Switch BuildKit cache from GHA to registry-based cache
(bgpkit/monocle:buildcache-{arch}), removing the 10 GB GHA limit.

Local Docker build verified: binary reports monocle 1.3.0.
@digizeph
digizeph merged commit 957de6f into main Jul 21, 2026
1 check passed
@digizeph
digizeph deleted the ci/native-docker-builds branch July 21, 2026 16:55
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