chore: speed up multi-arch Docker builds with cargo-zigbuild#52
chore: speed up multi-arch Docker builds with cargo-zigbuild#52mikkeldamsgaard merged 6 commits intomainfrom
Conversation
Replace QEMU-emulated arm64 compilation (~44 min) with native cross-compilation using cargo-zigbuild + sccache. Split release workflow into parallel test/build/docker/publish jobs. - Switch mysql crate from native-tls (OpenSSL) to rustls-tls, removing the entire OpenSSL dependency tree (~60 crates) - Replace multi-stage Rust Dockerfiles with minimal COPY-only images - Add cross-build and docker-multiarch Makefile targets - CI build job now cross-compiles both arches to warm sccache - Remove bin/ from .dockerignore (needed by new Dockerfiles) - Add Development section to README Expected release time: ~8-12 min (was ~50 min). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add workflow_dispatch trigger with dry-run input (defaults to true). In dry-run mode: Docker images are built but not pushed, cosign signing is skipped, and crates.io publish is skipped. Enables testing the full build pipeline without side effects. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR replaces QEMU-emulated multi-arch Docker builds with native cross-compilation using cargo-zigbuild and sccache, and switches the mysql crate from OpenSSL (native-tls) to rustls-tls to eliminate the OpenSSL dependency. The release and CI workflows are restructured into parallel jobs for faster execution.
Changes:
- Dockerfiles simplified from multi-stage Rust builds to minimal images that COPY pre-built, cross-compiled binaries; Makefile gains
cross-buildanddocker-multiarchtargets - CI and release workflows split into parallel
test/buildjobs usingcargo-zigbuild+sccache, with Docker and crates.io publish as downstream jobs mysqlcrate switched torustls-tlswithminimal-rustandbuffer-poolfeatures, removing ~60 transitive dependencies (OpenSSL, native-tls, etc.)
Reviewed changes
Copilot reviewed 9 out of 10 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| Dockerfile | Replaced multi-stage Rust build with minimal alpine certs stage + scratch, copying pre-built arch-specific binary |
| Dockerfile.jyq | Same simplification: alpine base with pre-built binary COPY using TARGETARCH |
| Makefile | Added cross-build and docker-multiarch targets; build now creates bin/ dir |
| Cargo.toml | Switched mysql crate to rustls-tls with minimal-rust and buffer-pool features |
| Cargo.lock | Updated lock file reflecting dependency tree changes |
| .github/workflows/release.yml | Split into test, build (matrix), docker, publish jobs with zigbuild + sccache |
| .github/workflows/ci.yml | Build job now cross-compiles for both arches with zigbuild + sccache |
| .dockerignore | Removed bin/ exclusion so Docker context includes pre-built binaries |
| README.md | Added Development section with cross-compilation prerequisites |
| CHANGELOG.md | Documented all workflow and build changes |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- actions/checkout v4 → v6 - actions/upload-artifact v4 → v7 - actions/download-artifact v4 → v8 - docker/build-push-action v6 → v7 - docker/setup-buildx-action v3 → v4 - docker/login-action v3 → v4 - sigstore/cosign-installer v3 → v4 - dprint/check v2.2 → v2.3 Node.js 20 will be deprecated June 2nd, 2026. mozilla-actions/sccache-action v0.0.9 has no newer release yet. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace `cargo install cargo-zigbuild` (compiles from source, ~40s) with `cargo binstall` (downloads pre-built binary, ~5s). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Addressing Copilot review: removed obsolete |
The new Dockerfile expects pre-built arch-specific binaries
(bin/initium-${TARGETARCH}), so plain `docker build` without
--platform no longer works. Use `make docker-multiarch` instead.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Summary
cargo-zigbuild+sccache, reducing release workflow from ~50 min to ~8-12 minmysqlcrate fromnative-tls(OpenSSL) torustls-tls, eliminating ~60 transitive dependencies while keeping binary size at ~5 MBtest→build(matrix amd64+arm64) →docker→publishjobs; crates.io publish now runs after Docker images are pushedTest plan
cargo test --all— 36 tests pass (unit + integration)cargo clippy -- -D warnings— no warningscargo fmt --check— formatteddprint check— formattedmake cross-build— produces correct static ELF binaries for both arches (file bin/initium-amd64 bin/initium-arm64)--helpworks, jq/yq available in jyq variant🤖 Generated with Claude Code