Skip to content

Commit

Permalink
Clear build cache during CI
Browse files Browse the repository at this point in the history
Appears there is an issue where the build cache grows unbounded until it hits Github's limit (docker/build-push-action#252, moby/buildkit#1896). Clear the cache after builds to prevent this.
  • Loading branch information
mdegat01 committed Nov 10, 2021
1 parent 67f1b6a commit be0a152
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ jobs:
cache-from: |
type=local,src=/tmp/.docker-cache
ghcr.io/mdegat01/${{ needs.information.outputs.slug }}/${{ matrix.architecture }}:edge
cache-to: type=local,mode=max,dest=/tmp/.docker-cache
cache-to: type=local,mode=max,dest=/tmp/.docker-cache-new
platforms: ${{ steps.flags.outputs.platform }}
build-args: |
BUILD_ARCH=${{ matrix.architecture }}
Expand All @@ -160,3 +160,11 @@ jobs:
BUILD_REF=${{ github.sha }}
BUILD_REPOSITORY=${{ github.repository }}
BUILD_VERSION=dev
# This ugly bit is necessary, or our cache will grow forever...
# Well until we hit GitHub's limit of 5GB :)
# https://github.com/docker/build-push-action/issues/252
# https://github.com/moby/buildkit/issues/1896
- name: 🚚 Swap build cache
run: |
rm -rf /tmp/.docker-cache
mv /tmp/.docker-cache-new /tmp/.docker-cache

0 comments on commit be0a152

Please sign in to comment.