From 7fadd5fdc3c7065bb2736c2772353e5e1bc06131 Mon Sep 17 00:00:00 2001 From: Markus Weigelt Date: Fri, 10 Jan 2025 16:58:47 +0100 Subject: [PATCH] Use load param of docker/build-push-action --- .github/scripts/test-image.sh | 2 -- .github/workflows/build-test-publish.yml | 21 +++++++++++++++++---- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/.github/scripts/test-image.sh b/.github/scripts/test-image.sh index bb28e633..24aa9686 100644 --- a/.github/scripts/test-image.sh +++ b/.github/scripts/test-image.sh @@ -1,8 +1,6 @@ #!/bin/bash cd ./Docker || exit 1 -docker compose build --build-arg BUILD_DATE="$1" --build-arg VCS_REF="$2" --build-arg VCS_URL="$3" - docker compose up -d # run wait for it diff --git a/.github/workflows/build-test-publish.yml b/.github/workflows/build-test-publish.yml index 88ab6857..d6f5cc00 100644 --- a/.github/workflows/build-test-publish.yml +++ b/.github/workflows/build-test-publish.yml @@ -61,10 +61,22 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 + - name: Build the DFG-Viewer image and cache to GitHub Actions cache + uses: docker/build-push-action@v6 + with: + build-args: | + BUILD_DATE=${{ env.build_date }} + VCS_REF=${{ env.vcs_ref }} + VCS_URL=https://github.com/${{ github.repository }}/tree/${{ github.ref_name }}/ + cache-to: type=gha,mode=max,scope=${{ env.vcs_ref }}-image + context: ./Docker/build + load: true + tags: ghcr.io/${{ github.repository }}:latest + - name: Test the DFG-Viewer image run: | chmod +x ./.github/scripts/test-image.sh - ./.github/scripts/test-image.sh ${{ env.build_date }} ${{ env.vcs_ref }} https://github.com/${{ github.repository }}/tree/${{ github.ref_name }}/ + ./.github/scripts/test-image.sh - name: Collect docker logs on failure if: failure() @@ -93,10 +105,11 @@ jobs: - name: Build the DFG-Viewer image using GitHub Actions cache and deploy to GitHub Container Repository uses: docker/build-push-action@v6 with: - context: ./Docker/build - push: true - tags: ghcr.io/${{ github.repository }}:latest build-args: | BUILD_DATE=${{ env.build_date }} VCS_REF=${{ env.vcs_ref }} VCS_URL=https://github.com/${{ github.repository }}/tree/${{ github.ref_name }}/ + cache-from: type=gha,scope=${{ env.vcs_ref }}-image + context: ./Docker/build + push: true + tags: ghcr.io/${{ github.repository }}:latest