From ca0aa229b25073ca3b18892147c3d82dc230643f Mon Sep 17 00:00:00 2001 From: DeKaiju Date: Thu, 15 Aug 2024 23:24:37 +0800 Subject: [PATCH] feat(docker): support build multi platform image --- .github/workflows/docker-acr.yml | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/workflows/docker-acr.yml b/.github/workflows/docker-acr.yml index f863b27..ce7d0fb 100644 --- a/.github/workflows/docker-acr.yml +++ b/.github/workflows/docker-acr.yml @@ -6,7 +6,7 @@ on: - "v*" jobs: - build-n-publish-to-ecr: + build-image-push-to-aliyun: runs-on: ubuntu-latest steps: @@ -15,12 +15,7 @@ jobs: run: echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT - name: Checkout - uses: actions/checkout@v2 - - - name: Set up Go - uses: actions/setup-go@v4 - with: - go-version: ">=1.17.0" + uses: actions/checkout@v4 - name: Login to ACR uses: aliyun/acr-login@v1 @@ -31,10 +26,15 @@ jobs: access-key-secret: "${{ secrets.ALI_ACCESS_KEY_SECRET }}" instance-id: "cri-a4wmsz77ru5o7hub" - - name: Build, tag, and push docker image to ACR - env: - REGISTRY: chainbase-registry.ap-southeast-1.cr.aliyuncs.com/network - REPOSITORY: chainbase-node - IMAGE_TAG: ${{ steps.get_version.outputs.VERSION }} - run: | - docker buildx build --platform linux/amd64,linux/arm64 -t $REGISTRY/$REPOSITORY:$IMAGE_TAG . && docker push $REGISTRY/$REPOSITORY:$IMAGE_TAG + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Build and push + uses: docker/build-push-action@v6 + with: + platforms: linux/amd64,linux/arm64 + push: true + tags: chainbase-registry.ap-southeast-1.cr.aliyuncs.com/network/chainbase-node:${{ steps.get_version.outputs.VERSION }}