Skip to content

Commit

Permalink
add caching of docker layers
Browse files Browse the repository at this point in the history
  • Loading branch information
peters-david committed Jan 23, 2025
1 parent e330886 commit ad044d0
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/build-and-publish-container-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ jobs:
use-black: false
use-mypy: false
use-isort: false
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@6524bf65af31da8d45b59e8c27de4bd072b392f5
- name: Log in to the container registry
uses: docker/login-action@327cd5a69de6c009b9ce71bce8395f28e651bf99
with:
Expand All @@ -53,12 +55,21 @@ jobs:
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
- name: Cache Docker layers
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Build container image for tests
uses: docker/build-push-action@67a2d409c0a876cbe6b11854e3e25193efe4e62d
with:
context: .
push: false
tags: ${{ env.IMAGE_NAME }}:test
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache,mode=max
- name: Test harbor tool
run: |
docker run --rm ${{ env.IMAGE_NAME }}:test /usr/local/harbor --help
Expand All @@ -69,3 +80,5 @@ jobs:
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache,mode=max

0 comments on commit ad044d0

Please sign in to comment.