Add docker metadata - fixes #19618

This commit is contained in:
Gavin Mogan 2025-09-04 21:42:16 -07:00
parent b781f06f9c
commit 130485d679
2 changed files with 34 additions and 13 deletions

View File

@ -3,9 +3,14 @@ description: 'Set up QEMU and Buildx'
inputs:
GITHUB_TOKEN:
required: true
tag-suffix:
required: false
type: string
outputs:
image-name:
value: ghcr.io/${{ steps.lowercaseRepo.outputs.lowercase }}:${{ steps.create-short-sha.outputs.SHORT_SHA }}
image-tags:
value: ${{ steps.meta.outputs.tags }}
image-labels:
value: ${{ steps.meta.outputs.labels }}
cache-name:
value: ghcr.io/${{ steps.lowercaseRepo.outputs.lowercase }}:cache
runs:
@ -48,3 +53,10 @@ runs:
- id: create-short-sha
run: echo "SHORT_SHA=${GITHUB_SHA::7}" >> $GITHUB_OUTPUT
shell: bash
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
# list of Docker images to use as base name for tags
images: ghcr.io/${{ steps.lowercaseRepo.outputs.lowercase }}
tags: type=raw,value=${{ steps.create-short-sha.outputs.SHORT_SHA }}${{ inputs.tag-suffix }}

View File

@ -31,6 +31,7 @@ jobs:
uses: ./.github/actions/setup
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
tag-suffix: "-amd64"
- name: Build and push amd64 standard build
uses: docker/build-push-action@v5
with:
@ -39,7 +40,8 @@ jobs:
push: true
platforms: linux/amd64
target: frigate
tags: ${{ steps.setup.outputs.image-name }}-amd64
labels: ${{ steps.setup.outputs.image-labels }}
tags: ${{ steps.setup.outputs.image-tags }}
cache-from: type=registry,ref=${{ steps.setup.outputs.cache-name }}-amd64
cache-to: type=registry,ref=${{ steps.setup.outputs.cache-name }}-amd64,mode=max
arm64_build:
@ -63,8 +65,8 @@ jobs:
push: true
platforms: linux/arm64
target: frigate
tags: |
${{ steps.setup.outputs.image-name }}-standard-arm64
labels: ${{ steps.setup.outputs.image-labels }}
tags: ${{ steps.setup.outputs.image-tags }}-standard-arm64
cache-from: type=registry,ref=${{ steps.setup.outputs.cache-name }}-arm64
- name: Build and push RPi build
uses: docker/bake-action@v6
@ -74,9 +76,9 @@ jobs:
targets: rpi
files: docker/rpi/rpi.hcl
set: |
rpi.tags=${{ steps.setup.outputs.image-name }}-rpi
*.cache-from=type=registry,ref=${{ steps.setup.outputs.cache-name }}-arm64
*.cache-to=type=registry,ref=${{ steps.setup.outputs.cache-name }}-arm64,mode=max
rpi.tags=${{ steps.setup.outputs.image-tags }}-rpi
*.cache-from=type=registry,ref=${{ steps.setup.outputs.cache-name }}-rpi
*.cache-to=type=registry,ref=${{ steps.setup.outputs.cache-name }}-rpi,mode=max
jetson_jp6_build:
runs-on: ubuntu-22.04-arm
name: Jetson Jetpack 6
@ -103,7 +105,7 @@ jobs:
targets: tensorrt
files: docker/tensorrt/trt.hcl
set: |
tensorrt.tags=${{ steps.setup.outputs.image-name }}-tensorrt-jp6
tensorrt.tags=${{ steps.setup.outputs.image-tags }}-tensorrt-jp6
*.cache-from=type=registry,ref=${{ steps.setup.outputs.cache-name }}-jp6
*.cache-to=type=registry,ref=${{ steps.setup.outputs.cache-name }}-jp6,mode=max
amd64_extra_builds:
@ -131,7 +133,7 @@ jobs:
targets: tensorrt
files: docker/tensorrt/trt.hcl
set: |
tensorrt.tags=${{ steps.setup.outputs.image-name }}-tensorrt
tensorrt.tags=${{ steps.setup.outputs.image-tags }}-tensorrt
*.cache-from=type=registry,ref=${{ steps.setup.outputs.cache-name }}-tensorrt
*.cache-to=type=registry,ref=${{ steps.setup.outputs.cache-name }}-tensorrt,mode=max
- name: AMD/ROCm general build
@ -145,7 +147,7 @@ jobs:
targets: rocm
files: docker/rocm/rocm.hcl
set: |
rocm.tags=${{ steps.setup.outputs.image-name }}-rocm
rocm.tags=${{ steps.setup.outputs.image-tags }}-rocm
*.cache-to=type=registry,ref=${{ steps.setup.outputs.cache-name }}-rocm,mode=max
*.cache-from=type=registry,ref=${{ steps.setup.outputs.cache-name }}-rocm
arm64_extra_builds:
@ -163,6 +165,7 @@ jobs:
uses: ./.github/actions/setup
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
tag-suffix: -rk
- name: Build and push Rockchip build
uses: docker/bake-action@v6
with:
@ -171,7 +174,7 @@ jobs:
targets: rk
files: docker/rockchip/rk.hcl
set: |
rk.tags=${{ steps.setup.outputs.image-name }}-rk
rk.tags=${{ steps.setup.outputs.image-tags }}
*.cache-from=type=gha
# The majority of users running arm64 are rpi users, so the rpi
# build should be the primary arm64 image
@ -194,9 +197,15 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }}
- name: Create short sha
run: echo "SHORT_SHA=${GITHUB_SHA::7}" >> $GITHUB_ENV
- uses: docker/metadata-action@v5
id: metadata
with:
images: ghcr.io/${{ steps.lowercaseRepo.outputs.lowercase }}
tags: type=raw,value=${{ env.SHORT_SHA }}
- uses: int128/docker-manifest-create-action@v2
with:
tags: ghcr.io/${{ steps.lowercaseRepo.outputs.lowercase }}:${{ env.SHORT_SHA }}
index-annotations: ${{ steps.metadata.outputs.labels }}
tags: ${{ steps.metadata.outputs.tags }}
sources: |
ghcr.io/${{ steps.lowercaseRepo.outputs.lowercase }}:${{ env.SHORT_SHA }}-amd64
ghcr.io/${{ steps.lowercaseRepo.outputs.lowercase }}:${{ env.SHORT_SHA }}-rpi