Skip to content

Commit

Permalink
fix(docker-build): use GHA built in docker layers cache
Browse files Browse the repository at this point in the history
  • Loading branch information
manast committed Feb 29, 2024
1 parent c939ed6 commit 0dd9c31
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions .github/workflows/build-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=raw,value={{sha}},enable=${{ github.ref_type != 'tag' }}
type=semver,pattern={{major}}

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
Expand All @@ -41,14 +41,6 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Cache Docker layers
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-

- name: Build and push
id: docker_build
uses: docker/build-push-action@v5
Expand All @@ -58,7 +50,9 @@ jobs:
pull: true # always fetch the latest base images

tags: ${{ steps.metadata.outputs.tags }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new
labels: ${{ steps.metadata.outputs.labels }}

cache-from: type=gha
cache-to: type=gha,mode=max
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}

0 comments on commit 0dd9c31

Please sign in to comment.