From 8bdb2b2a9b9bccfdcf86062dda9a6e46d907c8ba Mon Sep 17 00:00:00 2001 From: Pradumna Saraf Date: Wed, 18 Sep 2024 00:28:06 +0530 Subject: [PATCH 1/2] fix: Update Docker build and push actions to build and push multi-arch images Updated DockerHub and GHCR push actions to use the new Docker buildx action to build and push multi-arch images. --- .github/workflows/publish-dockerhub.yml | 20 ++++++++++++++------ .github/workflows/publish-ghcr.yml | 4 ++++ 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/.github/workflows/publish-dockerhub.yml b/.github/workflows/publish-dockerhub.yml index 8b379b4..5f22518 100644 --- a/.github/workflows/publish-dockerhub.yml +++ b/.github/workflows/publish-dockerhub.yml @@ -20,10 +20,18 @@ jobs: uses: docker/login-action@v3 with: username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_PASSWORD }} + password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Build the Docker image - run: docker build . --file Dockerfile --tag ${{ secrets.DOCKERHUB_USERNAME }}/devops:${{ steps.package-version.outputs.current-version}} - - - name: Docker Push - run: docker push ${{ secrets.DOCKERHUB_USERNAME }}/devops:${{ steps.package-version.outputs.current-version}} \ No newline at end of file + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Build and push Docker image + uses: docker/build-push-action@v6 + with: + context: . + file: ./Dockerfile + push: true + tags: | + ${{ secrets.DOCKERHUB_USERNAME }}/devops:latest + ${{ secrets.DOCKERHUB_USERNAME }}/devops:${{ steps.package-version.outputs.current-version}} + platforms: linux/amd64,linux/arm64,linux/arm/v7 diff --git a/.github/workflows/publish-ghcr.yml b/.github/workflows/publish-ghcr.yml index 9cb46b5..9b3b1b4 100644 --- a/.github/workflows/publish-ghcr.yml +++ b/.github/workflows/publish-ghcr.yml @@ -37,6 +37,9 @@ jobs: with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Build and push Docker image uses: docker/build-push-action@v6 with: @@ -45,4 +48,5 @@ jobs: tags: | ghcr.io/pradumnasaraf/devops:${{ steps.package-version.outputs.current-version}} ghcr.io/pradumnasaraf/devops:latest + platforms: linux/amd64,linux/arm64,linux/arm/v7 labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file From 409076b859bbe2cd2000e0f1297ef562e952ee05 Mon Sep 17 00:00:00 2001 From: Pradumna Saraf Date: Wed, 18 Sep 2024 00:31:50 +0530 Subject: [PATCH 2/2] add a blank line at the end of the file --- .github/workflows/publish-ghcr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish-ghcr.yml b/.github/workflows/publish-ghcr.yml index 9b3b1b4..b240ded 100644 --- a/.github/workflows/publish-ghcr.yml +++ b/.github/workflows/publish-ghcr.yml @@ -49,4 +49,4 @@ jobs: ghcr.io/pradumnasaraf/devops:${{ steps.package-version.outputs.current-version}} ghcr.io/pradumnasaraf/devops:latest platforms: linux/amd64,linux/arm64,linux/arm/v7 - labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file + labels: ${{ steps.meta.outputs.labels }}