Skip to content

Commit

Permalink
Use load param of docker/build-push-action
Browse files Browse the repository at this point in the history
  • Loading branch information
markusweigelt committed Jan 10, 2025
1 parent 667942b commit 7fadd5f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
2 changes: 0 additions & 2 deletions .github/scripts/test-image.sh
Original file line number Diff line number Diff line change
@@ -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
Expand Down
21 changes: 17 additions & 4 deletions .github/workflows/build-test-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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

0 comments on commit 7fadd5f

Please sign in to comment.