From e3daf7e54a74c52caaa88a341bd4bcb49fd27e95 Mon Sep 17 00:00:00 2001 From: spammenotinoz Date: Fri, 30 Aug 2024 20:45:02 +1000 Subject: [PATCH] Update build.yml --- .github/workflows/build.yml | 44 ++++++++++++++++++++++++++++--------- 1 file changed, 34 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 83259f30e3d..12fca8d96fe 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -40,19 +40,43 @@ jobs: type=semver,pattern={{major}}.{{minor}} type=semver,pattern={{major}} + - # Set up QEMU - name: Set up QEMU - uses: docker/setup-qemu-action@v2 + uses: docker/setup-qemu-action@v3 + # Set up Docker Buildx - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - - - name: Build and push Docker image - uses: docker/build-push-action@v4 + uses: docker/setup-buildx-action@v3 + + # Log in to GitHub Container Registry + - name: Log in to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + # Login to Docker Hub + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + # Prepare the environment + - name: Prepare environment + run: | + cp .env.example .env + + # Build and push Docker images for each target + - name: Build and push Docker images + uses: docker/build-push-action@v5 with: context: . - platforms: linux/amd64,linux/arm64 + file: ${{ matrix.file }} push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - cache-from: ${{ inputs.use-cache == 'true' && 'type=gha' || 'type=local,src=/tmp' }} - cache-to: ${{ inputs.use-cache == 'true' && 'type=gha, mode=max' || 'type=local,dest=/tmp' }} + tags: | + ghcr.io/${{ github.repository_owner }}/${{ matrix.image_name }}:latest} + ${{ secrets.DOCKERHUB_USERNAME }}/${{ matrix.image_name }}:latest + platforms: linux/amd64,linux/arm64 + target: ${{ matrix.target }} \ No newline at end of file