Skip to content

feat: native multi-arch docker build (opt-in reusable workflow)#278

Open
DeepDiver1975 wants to merge 4 commits into
masterfrom
feat/docker-build-native
Open

feat: native multi-arch docker build (opt-in reusable workflow)#278
DeepDiver1975 wants to merge 4 commits into
masterfrom
feat/docker-build-native

Conversation

@DeepDiver1975
Copy link
Copy Markdown
Contributor

What

Adds a new opt-in reusable workflow docker-build-native.yml that builds each architecture on a native runner instead of emulating arm64 under QEMU.

The existing docker-build.yml is left completely untouched — current consumers (server, base, php, ocis release) are unaffected. A repo opts in by changing its uses: line to docker-build-native.yml@master.

Why

docker-build.yml hardcodes platforms: linux/amd64,linux/arm64 on an amd64-only ubuntu-latest runner, so the arm64 half builds under QEMU emulation. For source-compiled images (e.g. oCIS: CGO_ENABLED=1 ENABLE_VIPS=true make release) the emulated half dominates wall-clock time (~60 min observed). It also means the arm64 image is never actually run/smoke-tested today.

How

Identical input/secret surface to docker-build.yml, with this topology:

  • build (matrix: amd64ubuntu-latest, arm64ubuntu-24.04-arm):
    builds + --loads the single-arch image, Trivy-scans it, smoke-tests it on its native runner, then (when push) logs in, re-builds with push-by-digest output, and uploads the digest as an artifact. cache-from/to get a per-arch scope=<arch> so the two legs don't clobber each other's GHA cache.
  • merge (if: push): downloads both digests, runs docker buildx imagetools create to assemble the multi-arch manifest under all tags, then imagetools inspect to verify.

This is Docker's documented multi-arch-via-matrix pattern.

Notes

  • ubuntu-24.04-arm is a GitHub-hosted runner, free for public repos.
  • Digest export and manifest merge fail loudly (explicit ::error:: + non-zero exit) if a digest is missing, so a partial build can never silently publish a single-arch manifest.
  • All actions pinned to full commit SHAs. actionlint clean.

🤖 Generated with Claude Code

DeepDiver1975 and others added 3 commits June 2, 2026 23:45
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Thomas Müller <1005065+DeepDiver1975@users.noreply.github.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Thomas Müller <1005065+DeepDiver1975@users.noreply.github.com>
Guard the digest export and manifest-merge steps so an empty digest
fails the job explicitly instead of silently publishing a single-arch
or broken manifest.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Thomas Müller <1005065+DeepDiver1975@users.noreply.github.com>
Add a build-native job to main.yml that invokes docker-build-native.yml
against the repo's own v24.04 base image on native amd64 + arm64 runners
with push:false. This asserts the new reusable workflow builds and
smoke-tests on both architectures end-to-end before any consumer relies
on it, mirroring how the existing build job dogfoods docker-build.yml.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Thomas Müller <1005065+DeepDiver1975@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

@phil-davis phil-davis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks Ok. The amd and arm test builds worked.

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.

2 participants