From d8bb9f2952588eba3667e9f4cc8475bdb1b1d2dd Mon Sep 17 00:00:00 2001 From: "Ibrahima G. Coulibaly" Date: Mon, 7 Apr 2025 20:01:17 +0100 Subject: [PATCH] ci: build docker image on push --- .github/workflows/ci.yml | 44 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c062fe4..8494d1d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -49,6 +49,50 @@ jobs: name: playwright-report path: playwright-report/ retention-days: 30 + build-and-push-docker: + name: Build and Push Multi-Platform Docker Image + runs-on: ubuntu-latest + needs: + - test-and-build + - e2e-test + if: github.ref == 'refs/heads/main' + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + with: + platforms: 'arm64,amd64' + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Login to DockerHub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Extract metadata for Docker + id: meta + uses: docker/metadata-action@v4 + with: + images: iib0011/omni-tools + tags: | + type=raw,value=latest + type=sha,format=short + + - name: Build and push Docker image + uses: docker/build-push-action@v4 + with: + context: . + platforms: linux/amd64,linux/arm64 + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max deploy: if: github.ref == 'refs/heads/main' needs: