From 525434c35d83ea2672efa75192496f85e6e5a289 Mon Sep 17 00:00:00 2001 From: "fletcher.fan" Date: Fri, 13 Mar 2026 13:19:36 +0800 Subject: [PATCH 1/3] ci: support multi-platform Docker image build (amd64 + arm64) Use docker/build-push-action with QEMU and buildx to build multi-arch images. Mac arm64 users can now pull and run the image natively. Co-Authored-By: Claude Opus 4.6 --- .github/workflows/docker_release.yml | 52 +++++++++++++++++----------- 1 file changed, 31 insertions(+), 21 deletions(-) diff --git a/.github/workflows/docker_release.yml b/.github/workflows/docker_release.yml index 54c8e8abc..bdbb7af0d 100644 --- a/.github/workflows/docker_release.yml +++ b/.github/workflows/docker_release.yml @@ -6,7 +6,7 @@ on: - morph-v* env: - IMAGE_NAME: go-ethereum + IMAGE_NAME: ghcr.io/${{ github.repository }} jobs: push: @@ -15,27 +15,37 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Log into registry - run: echo "${{ secrets.PACKAGE_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 - - name: Build the Docker image - run: | - docker build . --file Dockerfile \ - --build-arg COMMIT="${{ github.sha }}" \ - --build-arg VERSION="${{ github.ref_name }}" \ - -t "${IMAGE_NAME}" + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 - - name: Push image + - name: Log into registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.PACKAGE_TOKEN }} + + - name: Extract version + id: version run: | - IMAGE_ID="ghcr.io/${{ github.repository }}" - - # Change all uppercase to lowercase - IMAGE_ID=$(echo "$IMAGE_ID" | tr '[A-Z]' '[a-z]') - # Strip "morph-v" prefix from tag name VERSION=$(echo "${{ github.ref_name }}" | sed -e 's/^morph-v//') - echo IMAGE_ID="$IMAGE_ID" - echo VERSION="$VERSION" - docker tag "$IMAGE_NAME" "$IMAGE_ID:$VERSION" - docker tag "$IMAGE_NAME" "$IMAGE_ID:latest" - docker push "$IMAGE_ID:$VERSION" - docker push "$IMAGE_ID:latest" + echo "version=${VERSION}" >> $GITHUB_OUTPUT + + - name: Build and push + uses: docker/build-push-action@v6 + with: + context: . + file: Dockerfile + platforms: linux/amd64,linux/arm64 + push: true + tags: | + ${{ env.IMAGE_NAME }}:${{ steps.version.outputs.version }} + ${{ env.IMAGE_NAME }}:latest + build-args: | + COMMIT=${{ github.sha }} + VERSION=${{ github.ref_name }} + cache-from: type=gha + cache-to: type=gha,mode=max From c6cf593e73df3da7ad6b76173e278ffc58d3c39b Mon Sep 17 00:00:00 2001 From: "fletcher.fan" Date: Fri, 13 Mar 2026 13:24:09 +0800 Subject: [PATCH 2/3] ci: add workflow_dispatch for manual Docker image build Allow manually triggering the Docker build from GitHub Actions UI with a tag name input, useful for re-building existing tags. Co-Authored-By: Claude Opus 4.6 --- .github/workflows/docker_release.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker_release.yml b/.github/workflows/docker_release.yml index bdbb7af0d..f1dfc741e 100644 --- a/.github/workflows/docker_release.yml +++ b/.github/workflows/docker_release.yml @@ -4,6 +4,11 @@ on: push: tags: - morph-v* + workflow_dispatch: + inputs: + tag: + description: 'Tag name to build (e.g. morph-v2.2.0)' + required: true env: IMAGE_NAME: ghcr.io/${{ github.repository }} @@ -14,6 +19,8 @@ jobs: steps: - uses: actions/checkout@v4 + with: + ref: ${{ inputs.tag || github.ref }} - name: Set up QEMU uses: docker/setup-qemu-action@v3 @@ -31,7 +38,8 @@ jobs: - name: Extract version id: version run: | - VERSION=$(echo "${{ github.ref_name }}" | sed -e 's/^morph-v//') + TAG="${{ inputs.tag || github.ref_name }}" + VERSION=$(echo "$TAG" | sed -e 's/^morph-v//') echo "version=${VERSION}" >> $GITHUB_OUTPUT - name: Build and push @@ -46,6 +54,6 @@ jobs: ${{ env.IMAGE_NAME }}:latest build-args: | COMMIT=${{ github.sha }} - VERSION=${{ github.ref_name }} + VERSION=${{ inputs.tag || github.ref_name }} cache-from: type=gha cache-to: type=gha,mode=max From afa199ca2c2a4e66e6589071bae9dbd3ce388cf0 Mon Sep 17 00:00:00 2001 From: "fletcher.fan" Date: Fri, 13 Mar 2026 15:22:46 +0800 Subject: [PATCH 3/3] ci: fix incorrect COMMIT and VERSION on manual dispatch Use git rev-parse HEAD for COMMIT and stripped version for VERSION build-arg, so they are correct in both tag-push and workflow_dispatch. Co-Authored-By: Claude Opus 4.6 --- .github/workflows/docker_release.yml | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/workflows/docker_release.yml b/.github/workflows/docker_release.yml index f1dfc741e..fb3b062be 100644 --- a/.github/workflows/docker_release.yml +++ b/.github/workflows/docker_release.yml @@ -35,12 +35,14 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.PACKAGE_TOKEN }} - - name: Extract version - id: version + - name: Extract version and commit + id: meta run: | TAG="${{ inputs.tag || github.ref_name }}" VERSION=$(echo "$TAG" | sed -e 's/^morph-v//') - echo "version=${VERSION}" >> $GITHUB_OUTPUT + COMMIT=$(git rev-parse HEAD) + echo "version=${VERSION}" >> "$GITHUB_OUTPUT" + echo "commit=${COMMIT}" >> "$GITHUB_OUTPUT" - name: Build and push uses: docker/build-push-action@v6 @@ -50,10 +52,10 @@ jobs: platforms: linux/amd64,linux/arm64 push: true tags: | - ${{ env.IMAGE_NAME }}:${{ steps.version.outputs.version }} + ${{ env.IMAGE_NAME }}:${{ steps.meta.outputs.version }} ${{ env.IMAGE_NAME }}:latest build-args: | - COMMIT=${{ github.sha }} - VERSION=${{ inputs.tag || github.ref_name }} + COMMIT=${{ steps.meta.outputs.commit }} + VERSION=${{ steps.meta.outputs.version }} cache-from: type=gha cache-to: type=gha,mode=max