ci: build docker image on push

This commit is contained in:
Ibrahima G. Coulibaly
2025-04-07 20:01:17 +01:00
parent 5c26d9b54f
commit d8bb9f2952

View File

@@ -49,6 +49,50 @@ jobs:
name: playwright-report name: playwright-report
path: playwright-report/ path: playwright-report/
retention-days: 30 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: deploy:
if: github.ref == 'refs/heads/main' if: github.ref == 'refs/heads/main'
needs: needs: