Skip to content

TASK: speed up multi-arch docker build in GH Actions#18

Merged
skurfuerst merged 4 commits into
mainfrom
claude/optimize-docker-gh-actions-C1TId
May 7, 2026
Merged

TASK: speed up multi-arch docker build in GH Actions#18
skurfuerst merged 4 commits into
mainfrom
claude/optimize-docker-gh-actions-C1TId

Conversation

@skurfuerst
Copy link
Copy Markdown
Member

Pins the builder stage to BUILDPLATFORM so Go cross-compiles to
TARGETARCH natively instead of running under QEMU emulation, which
was the dominant cost (arm64 stage ran ~5-10x slower in QEMU on the
amd64 runner). Also drops the now-unused setup-qemu-action step,
removes the -a flag and merges the two go build invocations so they
share Go's compile cache, and adds -trimpath -ldflags="-s -w" for
smaller, reproducible binaries.

claude added 4 commits May 6, 2026 20:06
Pins the builder stage to BUILDPLATFORM so Go cross-compiles to
TARGETARCH natively instead of running under QEMU emulation, which
was the dominant cost (arm64 stage ran ~5-10x slower in QEMU on the
amd64 runner). Also drops the now-unused setup-qemu-action step,
removes the -a flag and merges the two go build invocations so they
share Go's compile cache, and adds -trimpath -ldflags="-s -w" for
smaller, reproducible binaries.
The explicit Always policy (added in bd728e4) blocked e2e: kind loads
the locally-built image into the node, but Always forces kubelet to
pull from example.com/nats-auth-operator:v0.0.1 (a placeholder
registry that does not exist), causing ErrImagePull. Removing the
line restores the per-tag default (IfNotPresent for pinned tags),
which is correct for kind-based testing.
Replaces the four split workflow files (docker-publish, lint, test,
test-e2e) with a single ci.yml. Three behavior changes:

- push trigger restricted to branches: [main] and tags: ['v*.*.*'].
  Previously every push to a PR branch triggered both push and
  pull_request events, doubling check runs on every commit.
- concurrency group keyed on workflow + ref with cancel-in-progress
  on pull_request only. Rapid PR updates now cancel the older run
  automatically; main-branch runs are protected from cancellation.
- pull_request now ignores docs-only changes (**.md, docs/**) so
  doc-only PRs skip the kind/buildx burn.

QEMU setup step is also gone (no longer needed once the Dockerfile
uses --platform=\$BUILDPLATFORM, applied earlier in this branch).
Production publish behavior is unchanged: the docker job still
gates push on event_name != pull_request.
@skurfuerst skurfuerst merged commit 860f317 into main May 7, 2026
4 checks passed
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