Skip to content

Commit

Permalink
ci: build and cache base image separately (#70)
Browse files Browse the repository at this point in the history
  • Loading branch information
hmenke authored and the-hampel committed Jan 15, 2024
1 parent 5956a01 commit 651b556
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,20 @@ jobs:
with:
images: ghcr.io/${{ github.repository }}_${{ matrix.name }}

- name: Build and push Docker image
- name: Build and cache base Docker image
uses: docker/build-push-action@v5
with:
context: ./Docker
file: ./Docker/${{ matrix.name }}_dockerfile
build-args: |
NCORES=2
target: base
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha,scope=${{ github.ref_name }}-${{ matrix.name }}
cache-to: type=gha,mode=max,scope=${{ github.ref_name }}-${{ matrix.name }}

- name: Build and push final Docker image
uses: docker/build-push-action@v5
with:
context: ./Docker
Expand All @@ -53,5 +66,3 @@ jobs:
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha,scope=${{ github.ref_name }}-${{ matrix.name }}
cache-to: type=gha,mode=max,scope=${{ github.ref_name }}-${{ matrix.name }}

0 comments on commit 651b556

Please sign in to comment.