From 7454372bfc37c52d4cc7571769b347fad86efb95 Mon Sep 17 00:00:00 2001 From: Rick Lam Date: Tue, 26 May 2026 17:56:00 +0100 Subject: [PATCH 1/2] Publish multi-arch Docker image via buildx Adds a GH Actions workflow that builds linux/amd64 + linux/arm64 manifests on tag push and pushes to graze/morphism on Docker Hub, fixing "no matching manifest for linux/arm64/v8" pulls on Apple Silicon. Switches the Makefile to buildx (host-arch by default, with a build-docker-multiarch target for local cross builds) and removes the legacy Docker Hub Automated Builds hooks/build script. Co-Authored-By: Claude Opus 4.7 (1M context) --- .github/workflows/docker.yml | 52 ++++++++++++++++++++++++++++++++++++ Makefile | 18 ++++++++++++- hooks/build | 7 ----- 3 files changed, 69 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/docker.yml delete mode 100644 hooks/build diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000..bd945c4 --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,52 @@ +name: Publish Docker image + +on: + push: + tags: + - 'v[0-9]+.[0-9]+' + - 'v[0-9]+.[0-9]+.[0-9]+' + +permissions: + contents: read + +jobs: + publish: + name: Build & push multi-arch image + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Extract image metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: graze/morphism + tags: | + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=raw,value=latest + + - name: Build and push + uses: docker/build-push-action@v6 + with: + context: . + platforms: linux/amd64,linux/arm64 + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + build-args: | + BUILD_DATE=${{ github.event.repository.updated_at }} + VCS_REF=${{ github.sha }} + provenance: false diff --git a/Makefile b/Makefile index 2500bb7..2c854e8 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,7 @@ DOCKER_RUN := ${DOCKER_RUN_BASE} ${IMAGE} PREFER_LOWEST ?= -.PHONY: build build-update composer-% clean help run +.PHONY: build build-update build-docker build-docker-multiarch composer-% clean help run .PHONY: lint lint-fix .PHONY: test test-unit test-integration test-lowest test-matrix test-coverage test-coverage-html test-coverage-clover @@ -38,6 +38,22 @@ composer-%: ## Run a composer command, `make "composer- [...]"`. ensure-conf-file: # Ensure that there is a configuration file in dev @test -f morphism.conf || cp example/morphism.conf.example morphism.conf +PLATFORMS ?= linux/amd64,linux/arm64 + +build-docker: ## Build the docker image for the host architecture and load it locally. + docker buildx build --load \ + --build-arg BUILD_DATE="$$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \ + --build-arg VCS_REF="$$(git rev-parse --short HEAD)" \ + -t graze/morphism . + +build-docker-multiarch: ## Build the docker image for multiple architectures (no load; set PUSH=1 to push). + docker buildx build \ + --platform ${PLATFORMS} \ + $(if $(PUSH),--push,) \ + --build-arg BUILD_DATE="$$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \ + --build-arg VCS_REF="$$(git rev-parse --short HEAD)" \ + -t graze/morphism . + # Testing test: ## Run the unit and integration testsuites. diff --git a/hooks/build b/hooks/build deleted file mode 100644 index 93df1c5..0000000 --- a/hooks/build +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -set +xe - -docker build --build-arg BUILD_DATE="$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \ - --build-arg VCS_REF="$(git rev-parse --short HEAD)" \ - -t "$IMAGE_NAME" . From 6cfda43b8d22d31e75b400ad1f53c6fd0b3b1404 Mon Sep 17 00:00:00 2001 From: Rick Lam Date: Wed, 27 May 2026 08:29:27 +0100 Subject: [PATCH 2/2] Address PR review: real build date, drop two-segment tag trigger - Compute BUILD_DATE with `date -u` in a prior step instead of github.event.repository.updated_at, which is the repo's last-update time and drifts from the actual build. This matches the timestamp convention in the Makefile targets. - Drop the 'v[0-9]+.[0-9]+' tag trigger: releases are always cut as full MAJOR.MINOR.PATCH tags, and type=semver,pattern={{version}} skips two-segment tags anyway (publishing only `latest`). Co-Authored-By: Claude Opus 4.7 (1M context) --- .github/workflows/docker.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index bd945c4..23c6c9c 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -3,7 +3,6 @@ name: Publish Docker image on: push: tags: - - 'v[0-9]+.[0-9]+' - 'v[0-9]+.[0-9]+.[0-9]+' permissions: @@ -16,6 +15,10 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Compute build date + id: build_date + run: echo "value=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> "$GITHUB_OUTPUT" + - name: Set up QEMU uses: docker/setup-qemu-action@v3 @@ -47,6 +50,6 @@ jobs: tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} build-args: | - BUILD_DATE=${{ github.event.repository.updated_at }} + BUILD_DATE=${{ steps.build_date.outputs.value }} VCS_REF=${{ github.sha }} provenance: false