Skip to content

ci: auto build multi-arch image to GHCR with cleanup - #2

Closed
webees wants to merge 1 commit into
openprx:mainfrom
mixtoolhq:ci/docker-ghcr
Closed

webees wants to merge 1 commit into
openprx:mainfrom
mixtoolhq:ci/docker-ghcr

Conversation

@webees

@webees webees commented Sep 21, 2026

Copy link
Copy Markdown

What

Adds .github/workflows/docker.yml and optimizes the existing Dockerfile so every code change produces a ready-to-pull container image in GHCR.

Changes

  • Multi-arch build without QEMU: linux/amd64 builds on ubuntu-latest, linux/arm64 builds on the native ubuntu-24.04-arm runner; per-arch digests are merged into a single manifest list afterwards.
  • Triggers: push to main, v* tags, and manual dispatch. Markdown/docs-only changes are skipped. PRs build the image without pushing (no registry credentials used).
  • Tags: latest on the default branch, plus branch, short SHA, and semver tags on v* releases.
  • Speed: cached npm/go dependency layers, BuildKit cache mounts, and per-arch GHA cache scopes. Cold build is roughly 2.5 min total.
  • Dockerfile fix: frontend assets are arch-independent, so they are built on $BUILDPLATFORM; this avoids vite/rollup native binaries crashing under arm64 emulation (qemu: uncaught target signal 4, exit 132). Also switched to npm ci for reproducible installs.
  • Retention: each run trims old GHCR package versions (actions/delete-package-versions, untagged only) and old Actions runs (Mattraks/delete-workflow-runs), keeping the latest entries. Both actions are pinned by commit SHA.

Side effects worth a look before merging

  • On merge, pushes to main will publish ghcr.io/openprx/fenfa automatically, including a latest tag.
  • The retention step deletes older untagged package versions and older workflow runs in this repository. If you would rather keep full history, drop the two cleanup steps at the end of the merge job.

Verification

  • actionlint .github/workflows/docker.yml passes (exit 0).
  • Verified end-to-end in a fork: build(amd64), build(arm64) and merge all succeed; the merged manifest resolves both platforms, and the cleanup steps report successful deletions while skipping the in-progress run.

Add Docker workflow: on push to main / v* tags build linux/amd64 and linux/arm64 images on native runners, merge them into a multi-arch manifest and push to GHCR. PRs build without pushing.

Speed up builds with cached npm/go layers and per-arch GHA cache scopes, and keep Actions runs and GHCR package versions trimmed to the latest after every run.

Also build frontend assets on BUILDPLATFORM and use npm ci in the Dockerfile so arm64 builds no longer hit QEMU SIGILL.
@mixtoolhq mixtoolhq closed this by deleting the head repository Sep 21, 2026
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