From 931d2aa9f721f8465c72ab2249b592da8d31a77f Mon Sep 17 00:00:00 2001 From: Yao Date: Wed, 17 Jun 2026 14:54:12 +1000 Subject: [PATCH 1/2] ci: native multi-arch publish (amd64 + arm64, no QEMU) Build each (image, arch) on a native runner (arm64 on ubuntu-24.04-arm), push by digest, and merge per-arch digests into one multi-arch manifest per image. Replaces the emulated arm64 leg that stalled 40+ min. Co-Authored-By: Claude Opus 4.8 (1M context) --- .github/workflows/publish-image.yml | 83 ++++++++++++++++++++++------- 1 file changed, 64 insertions(+), 19 deletions(-) diff --git a/.github/workflows/publish-image.yml b/.github/workflows/publish-image.yml index 9531288..24d39db 100644 --- a/.github/workflows/publish-image.yml +++ b/.github/workflows/publish-image.yml @@ -10,22 +10,70 @@ permissions: contents: read packages: write +# Native multi-arch: each (image, arch) builds on a native runner (no QEMU), +# pushes by digest, then a merge job stitches the per-arch digests into one +# multi-arch manifest per image. amd64 on ubuntu-latest, arm64 on the native +# ubuntu-24.04-arm runner. jobs: - publish: - runs-on: ubuntu-latest + build: + runs-on: ${{ matrix.runner }} strategy: fail-fast: false matrix: include: - - image: tidebase - dockerfile: apps/server/Dockerfile - - image: tidebase-mcp - dockerfile: apps/mcp/Dockerfile + - { image: tidebase, dockerfile: apps/server/Dockerfile, platform: linux/amd64, arch: amd64, runner: ubuntu-latest } + - { image: tidebase, dockerfile: apps/server/Dockerfile, platform: linux/arm64, arch: arm64, runner: ubuntu-24.04-arm } + - { image: tidebase-mcp, dockerfile: apps/mcp/Dockerfile, platform: linux/amd64, arch: amd64, runner: ubuntu-latest } + - { image: tidebase-mcp, dockerfile: apps/mcp/Dockerfile, platform: linux/arm64, arch: arm64, runner: ubuntu-24.04-arm } steps: - uses: actions/checkout@v4 - uses: docker/setup-buildx-action@v3 + - uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - id: build + uses: docker/build-push-action@v6 + with: + context: . + file: ${{ matrix.dockerfile }} + platforms: ${{ matrix.platform }} + outputs: type=image,name=ghcr.io/blueprintlabio/${{ matrix.image }},push-by-digest=true,name-canonical=true,push=true + cache-from: type=gha,scope=${{ matrix.image }}-${{ matrix.arch }} + cache-to: type=gha,mode=max,scope=${{ matrix.image }}-${{ matrix.arch }} + + - name: Export digest + run: | + mkdir -p "${{ runner.temp }}/digests" + digest="${{ steps.build.outputs.digest }}" + touch "${{ runner.temp }}/digests/${digest#sha256:}" + + - uses: actions/upload-artifact@v4 + with: + name: digests-${{ matrix.image }}-${{ matrix.arch }} + path: ${{ runner.temp }}/digests/* + if-no-files-found: error + retention-days: 1 + + merge: + needs: build + runs-on: ubuntu-latest + strategy: + matrix: + image: [tidebase, tidebase-mcp] + steps: + - uses: actions/download-artifact@v4 + with: + path: ${{ runner.temp }}/digests + pattern: digests-${{ matrix.image }}-* + merge-multiple: true + + - uses: docker/setup-buildx-action@v3 + - uses: docker/login-action@v3 with: registry: ghcr.io @@ -37,19 +85,16 @@ jobs: with: images: ghcr.io/blueprintlabio/${{ matrix.image }} tags: | - type=ref,event=tag type=raw,value=latest,enable={{is_default_branch}} type=sha + type=ref,event=tag - - uses: docker/build-push-action@v6 - with: - context: . - file: ${{ matrix.dockerfile }} - # amd64 only: matches the deploy target (Coolify host) and builds - # natively on the GitHub runner. Native arm64 is added separately. - platforms: linux/amd64 - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - cache-from: type=gha,scope=${{ matrix.image }} - cache-to: type=gha,mode=max,scope=${{ matrix.image }} + - name: Create multi-arch manifest + working-directory: ${{ runner.temp }}/digests + run: | + docker buildx imagetools create \ + $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ + $(printf 'ghcr.io/blueprintlabio/${{ matrix.image }}@sha256:%s ' *) + + - name: Inspect + run: docker buildx imagetools inspect ghcr.io/blueprintlabio/${{ matrix.image }}:${{ steps.meta.outputs.version }} From 12ca079b3b8a21a2e9aa366e5aaf298bb9486940 Mon Sep 17 00:00:00 2001 From: Yao Date: Wed, 17 Jun 2026 14:57:03 +1000 Subject: [PATCH 2/2] ci: fix digest artifact name collision (tidebase vs tidebase-mcp) Co-Authored-By: Claude Opus 4.8 (1M context) --- .github/workflows/publish-image.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish-image.yml b/.github/workflows/publish-image.yml index 24d39db..4943646 100644 --- a/.github/workflows/publish-image.yml +++ b/.github/workflows/publish-image.yml @@ -54,7 +54,8 @@ jobs: - uses: actions/upload-artifact@v4 with: - name: digests-${{ matrix.image }}-${{ matrix.arch }} + # `--` delimiter so `tidebase` does not prefix-match `tidebase-mcp`. + name: digests-${{ matrix.image }}--${{ matrix.arch }} path: ${{ runner.temp }}/digests/* if-no-files-found: error retention-days: 1 @@ -69,7 +70,7 @@ jobs: - uses: actions/download-artifact@v4 with: path: ${{ runner.temp }}/digests - pattern: digests-${{ matrix.image }}-* + pattern: digests-${{ matrix.image }}--* merge-multiple: true - uses: docker/setup-buildx-action@v3