From be71f99f06e8d7840350b36e6d87ea667d1b9200 Mon Sep 17 00:00:00 2001 From: Christian Krakau-Louis Date: Thu, 27 Mar 2025 15:56:32 +0100 Subject: [PATCH] updated the build file Please enter the commit message for your changes. Lines starting --- .github/workflows/docker-image.yml | 42 +++++++++++++++++++++++++++--- 1 file changed, 38 insertions(+), 4 deletions(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index c831f92..ea473ed 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -1,8 +1,17 @@ name: Build and Push Docker Image +permissions: + contents: read + packages: write + on: push: - branches: [ "main" ] + branches: + - main + - develop + pull_request: + branches: + - main jobs: build-and-push: @@ -12,15 +21,40 @@ jobs: - name: Check out repository uses: actions/checkout@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - name: Log in to Docker Hub uses: docker/login-action@v2 with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - - name: Build and push - uses: docker/build-push-action@v3 + - name: Log in to GitHub Container Registry + uses: docker/login-action@v2 with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and Push + uses: docker/build-push-action@v4 + with: + # Build for multiple platforms + platforms: linux/amd64,linux/arm64 + + # Path to Docker context and Dockerfile (adjust if needed) context: . + file: Dockerfile + + # Push images to both Docker Hub and GHCR push: true - tags: your-dockerhub-username/random-pdf:latest + tags: | + christianlouis/docdice:latest + christianlouis/docdice:${{ github.sha }} + ghcr.io/${{ github.repository_owner }}/docdice:latest + ghcr.io/${{ github.repository_owner }}/docdice:${{ github.sha }} + + # Caching options to speed up subsequent builds + cache-from: type=gha + cache-to: type=gha,mode=max