From f569c176730f77fade0b575c1422dd4f52dbbd60 Mon Sep 17 00:00:00 2001 From: Max Revitt Date: Mon, 8 Apr 2024 14:31:12 +0100 Subject: [PATCH 1/2] fix(build): docker build manifest --- .github/workflows/build.yml | 63 +++++++++++++++++++------------------ 1 file changed, 33 insertions(+), 30 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 20d15710447..9c479083421 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -26,7 +26,6 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v4 - - name: Prepare id: prep run: | @@ -45,69 +44,73 @@ jobs: fi fi echo "version=$TAG" >> $GITHUB_OUTPUT - # Determine if latest tag should be applied if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then echo "LATEST_TAG=false" >> $GITHUB_ENV else echo "LATEST_TAG=true" >> $GITHUB_ENV fi - build-and-push-amd64: + build-amd64: needs: prepare runs-on: ubuntu-latest steps: - name: Checkout code 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: Login to DockerHub - uses: docker/login-action@v1 + uses: docker/login-action@v3 with: username: ${{ env.DOCKERHUB_USERNAME }} password: ${{ env.DOCKERHUB_TOKEN }} - - - name: Build and Push Docker Image (amd64) - uses: docker/build-push-action@v5 + - name: Build and push AMD64 image + uses: docker/build-push-action@v3 with: context: . file: Dockerfile - platforms: linux/amd64 push: true - tags: | - ${{ env.IMAGE_NAME }}:${{ needs.prepare.outputs.version }} - ${{ needs.prepare.outputs.latest_tag == 'true' && format('{0}:latest', env.IMAGE_NAME) || '' }} + tags: ${{ env.IMAGE_NAME }}:${{ needs.prepare.outputs.version }}-amd64 + platforms: linux/amd64 - build-and-push-arm64: + build-arm64: needs: prepare runs-on: ubuntu-latest steps: - name: Checkout code 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: Login to DockerHub - uses: docker/login-action@v1 + uses: docker/login-action@v3 with: username: ${{ env.DOCKERHUB_USERNAME }} password: ${{ env.DOCKERHUB_TOKEN }} - - - name: Build and Push Docker Image (arm64) - uses: docker/build-push-action@v5 + - name: Build and push ARM64 image + uses: docker/build-push-action@v3 with: context: . file: Dockerfile - platforms: linux/arm64 push: true - tags: | - ${{ env.IMAGE_NAME }}:${{ needs.prepare.outputs.version }} - ${{ needs.prepare.outputs.latest_tag == 'true' && format('{0}:latest', env.IMAGE_NAME) || '' }} + tags: ${{ env.IMAGE_NAME }}:${{ needs.prepare.outputs.version }}-arm64 + platforms: linux/arm64 + + create-and-push-manifest: + needs: [build-amd64, build-arm64] + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Login to DockerHub + uses: docker/login-action@v3 + with: + username: ${{ env.DOCKERHUB_USERNAME }} + password: ${{ env.DOCKERHUB_TOKEN }} + - name: Create and push manifest + run: | + docker buildx create --use + docker buildx build --push --platform linux/amd64,linux/arm64 --tag ${{ env.IMAGE_NAME }}:${{ needs.prepare.outputs.version }} --file Dockerfile . + if [ "${{ needs.prepare.outputs.latest_tag }}" == "true" ]; then + docker buildx build --push --platform linux/amd64,linux/arm64 --tag ${{ env.IMAGE_NAME }}:latest --file Dockerfile . + fi \ No newline at end of file From c886919b70a56040c7286046efd60df74988923f Mon Sep 17 00:00:00 2001 From: Max Revitt Date: Mon, 8 Apr 2024 14:47:13 +0100 Subject: [PATCH 2/2] temp: branch trigger --- .github/workflows/build.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9c479083421..e6f2de0b015 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,6 +2,8 @@ name: Build and Push Docker on: push: + branches: + - fix/docker-build-push tags: - 'v*' release: