Switch from gha cache to registry cache

A CI run (four images cached with mode-max) populates the cache with 295
cache entries totalling 23.44 GB. This exceeds gha's 10GB limit, causing
trashing. Try with a registry instead.
This commit is contained in:
Andrew Reiter 2023-07-26 17:49:10 -04:00
parent ca4117216a
commit ce4048b5f6
2 changed files with 19 additions and 20 deletions

View File

@ -4,8 +4,10 @@ inputs:
GITHUB_TOKEN:
required: true
outputs:
lowercase-repo:
value: ${{ steps.lowercaseRepo.outputs.lowercase }}
image-name:
value: ghcr.io/${{ steps.lowercaseRepo.outputs.lowercase }}:${{ github.ref_name }}-${{ env.SHORT_SHA }}
cache-name:
value: ghcr.io/${{ steps.lowercaseRepo.outputs.lowercase }}:cache
runs:
using: "composite"
steps:

View File

@ -34,10 +34,9 @@ jobs:
push: true
platforms: linux/amd64
target: frigate
tags: |
ghcr.io/${{ steps.setup.outputs.lowercase-repo }}:${{ github.ref_name }}-${{ env.SHORT_SHA }}-amd64
cache-from: type=gha
cache-to: type=gha,mode=max,compression=zstd
tags: ${{ steps.setup.outputs.image-name }}-amd64
cache-from: type=registry,ref=${{ steps.setup.outputs.cache-name }}-amd64
cache-to: type=registry,ref=${{ steps.setup.outputs.cache-name }}-amd64,mode=max,compression=zstd
- name: Build and push TensorRT (x86 GPU)
uses: docker/bake-action@v3
with:
@ -45,8 +44,7 @@ jobs:
targets: tensorrt
files: docker/tensorrt/trt.hcl
set: |
tensorrt.tags=ghcr.io/${{ steps.setup.outputs.lowercase-repo }}:${{ github.ref_name }}-${{ env.SHORT_SHA }}-tensorrt
*.cache-from=type=gha
tensorrt.tags=${{ steps.setup.outputs.image-name }}-tensorrt
arm64_build:
runs-on: ubuntu-latest
name: ARM Build
@ -67,9 +65,9 @@ jobs:
platforms: linux/arm64
target: frigate
tags: |
ghcr.io/${{ steps.setup.outputs.lowercase-repo }}:${{ github.ref_name }}-${{ env.SHORT_SHA }}-standard-arm64
cache-from: type=gha
cache-to: type=gha,mode=max,compression=zstd
${{ steps.setup.outputs.image-name }}-standard-arm64
cache-from: type=registry,ref=${{ steps.setup.outputs.cache-name }}-standard-arm64
cache-to: type=registry,ref=${{ steps.setup.outputs.cache-name }}-standard-arm64,mode=max,compression=zstd
- name: Build and push RPi build
uses: docker/bake-action@v3
with:
@ -77,8 +75,7 @@ jobs:
targets: rpi
files: docker/rpi/rpi.hcl
set: |
rpi.tags=ghcr.io/${{ steps.setup.outputs.lowercase-repo }}:${{ github.ref_name }}-${{ env.SHORT_SHA }}-rpi
*.cache-from=type=gha
rpi.tags=${{ steps.setup.outputs.image-name }}-rpi
jetson_jp4_build:
runs-on: ubuntu-latest
name: Jetson Jetpack 4
@ -102,9 +99,9 @@ jobs:
targets: tensorrt
files: docker/tensorrt/trt.hcl
set: |
tensorrt.tags=ghcr.io/${{ steps.setup.outputs.lowercase-repo }}:${{ github.ref_name }}-${{ env.SHORT_SHA }}-tensorrt-jp4
*.cache-from=type=gha
*.cache-to=type=gha,mode=max,compression=zstd
tensorrt.tags=${{ steps.setup.outputs.image-name }}-tensorrt-jp4
*.cache-from=type=registry,ref=${{ steps.setup.outputs.cache-name }}-tensorrt-jp4
*.cache-to=type=registry,ref=${{ steps.setup.outputs.cache-name }}-tensorrt-jp4,mode=max,compression=zstd
jetson_jp5_build:
runs-on: ubuntu-latest
name: Jetson Jetpack 5
@ -128,9 +125,9 @@ jobs:
targets: tensorrt
files: docker/tensorrt/trt.hcl
set: |
tensorrt.tags=ghcr.io/${{ steps.setup.outputs.lowercase-repo }}:${{ github.ref_name }}-${{ env.SHORT_SHA }}-tensorrt-jp5
*.cache-from=type=gha
*.cache-to=type=gha,mode=max,compression=zstd
tensorrt.tags=${{ steps.setup.outputs.image-name }}-tensorrt-jp5
*.cache-from=type=registry,ref=${{ steps.setup.outputs.cache-name }}-tensorrt-jp5
*.cache-to=type=registry,ref=${{ steps.setup.outputs.cache-name }}-tensorrt-jp5,mode=max,compression=zstd
# The majority of users running arm64 are rpi users, so the rpi
# build should be the primary arm64 image
assemble_default_build:
@ -154,7 +151,7 @@ jobs:
run: echo "SHORT_SHA=${GITHUB_SHA::7}" >> $GITHUB_ENV
- uses: int128/docker-manifest-create-action@v1
with:
tags: ghcr.io/${{ steps.setup.outputs.lowercase-repo }}:${{ github.ref_name }}-${{ env.SHORT_SHA }}
tags: ${{ steps.setup.outputs.image-name }}
suffixes: |
-amd64
-rpi