From 845f09df9b300d9f7ce0af0612849e8a3e1200c4 Mon Sep 17 00:00:00 2001 From: Nazarii Date: Fri, 3 Jan 2025 20:34:50 +0200 Subject: [PATCH] Test workflow with platform ARM --- .github/workflows/main.yml | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2e7e576..db8ca58 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -2,45 +2,53 @@ name: Docker Image CI on: push: - branches: [ master ] + branches: [ blog ] workflow_dispatch: env: - DOCKER_IMAGE_REPO: bandirom/django-template + REGISTRY: docker.io + DOCKER_IMAGE_REPO: bandirom/django-blog + TARGET_PLATFORMS: linux/amd64,linux/arm64 jobs: - tests: - uses: ./.github/workflows/tests.yml - secrets: inherit +# tests: +# uses: ./.github/workflows/tests.yml +# secrets: inherit push: runs-on: ubuntu-latest - needs: [tests] +# needs: [tests] steps: - name: Checkout Repo uses: actions/checkout@v4 + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Login to Docker Hub uses: docker/login-action@v3 with: + registry: ${{ env.REGISTRY }} username: ${{ secrets.DOCKER_HUB_USERNAME }} password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} - name: Extract metadata (tags, labels) for Docker id: meta uses: docker/metadata-action@v5 with: - images: ${{ env.DOCKER_IMAGE_REPO }} + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} tags: | - type=sha,format=short,prefix= + type=schedule + type=ref,event=branch + type=ref,event=tag + type=ref,event=pr + type=sha - name: Build and push - uses: docker/build-push-action@v5 + uses: docker/build-push-action@v6 with: push: ${{ github.event_name != 'pull_request' }} context: . - tags: | - ${{ steps.meta.outputs.tags }} - ${{ env.DOCKER_IMAGE_REPO }}:latest + tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} + platforms: ${{ env.TARGET_PLATFORMS }} file: docker/prod/web/Dockerfile cache-from: type=registry,ref=${{ env.DOCKER_IMAGE_REPO }}:latest cache-to: type=inline