From 0b094d5acd14ef20f386109a546e3ffad0e4260d Mon Sep 17 00:00:00 2001 From: Billy Zha Date: Wed, 7 Dec 2022 20:21:03 +0800 Subject: [PATCH] build: add multi-arch image (#46) This PR reuses upstream Buildx Bake configuration to build multi-arch images for registry. Resolves: #45 Signed-off-by: Billy Zha --- .github/workflows/oras-release.yml | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/.github/workflows/oras-release.yml b/.github/workflows/oras-release.yml index a2ab92d8d44..6668a4778c2 100644 --- a/.github/workflows/oras-release.yml +++ b/.github/workflows/oras-release.yml @@ -4,6 +4,7 @@ on: push: tags: - "v[0-9]+.[0-9]+.[0-9]+-rc.[0-9]+" + workflow_dispatch: jobs: publish: @@ -46,14 +47,19 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Build and push + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + id: setup_buildx + + - name: Build image if: ${{ success() }} - uses: docker/build-push-action@v2 + uses: docker/bake-action@v1 with: - context: . - file: ./Dockerfile - platforms: linux/amd64 + flavor: latest=auto + files: | + ./docker-bake.hcl + targets: image-all push: true - tags: | - ${{ env.REGISTRY }}/${{ env.REPOSITORY }}:${{ steps.get_image_tag.outputs.docker_tag }} - ${{ env.REGISTRY }}/${{ env.REPOSITORY }}:latest \ No newline at end of file + set: | + image-all.tags=${{ env.REGISTRY }}/${{ env.REPOSITORY }}:${{ steps.get_image_tag.outputs.docker_tag }} + image-all.tags=${{ env.REGISTRY }}/${{ env.REPOSITORY }}:latest \ No newline at end of file