2022-11-06 14:19:00 +01:00
|
|
|
name: CI
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- dev
|
|
|
|
- master
|
|
|
|
|
2023-01-19 00:30:49 +01:00
|
|
|
# only run the latest commit to avoid cache overwrites
|
|
|
|
concurrency:
|
|
|
|
group: ${{ github.ref }}
|
|
|
|
cancel-in-progress: true
|
|
|
|
|
2022-11-06 14:19:00 +01:00
|
|
|
env:
|
|
|
|
PYTHON_VERSION: 3.9
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
multi_arch_build:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
name: Image Build
|
|
|
|
steps:
|
2023-03-05 16:14:11 +01:00
|
|
|
- name: Remove unnecessary files
|
|
|
|
run: |
|
|
|
|
sudo rm -rf /usr/share/dotnet
|
|
|
|
sudo rm -rf /usr/local/lib/android
|
|
|
|
sudo rm -rf /opt/ghc
|
2023-01-30 00:21:31 +01:00
|
|
|
- id: lowercaseRepo
|
2023-01-30 13:15:04 +01:00
|
|
|
uses: ASzc/change-string-case-action@v5
|
2023-01-30 00:21:31 +01:00
|
|
|
with:
|
|
|
|
string: ${{ github.repository }}
|
2022-11-06 14:19:00 +01:00
|
|
|
- name: Check out code
|
2022-11-07 14:18:10 +01:00
|
|
|
uses: actions/checkout@v3
|
2022-11-06 14:19:00 +01:00
|
|
|
- name: Set up QEMU
|
2022-11-07 14:18:10 +01:00
|
|
|
uses: docker/setup-qemu-action@v2
|
2022-11-06 14:19:00 +01:00
|
|
|
- name: Set up Docker Buildx
|
2022-11-07 14:18:10 +01:00
|
|
|
uses: docker/setup-buildx-action@v2
|
2022-11-06 14:19:00 +01:00
|
|
|
- name: Log in to the Container registry
|
2023-06-11 14:21:59 +02:00
|
|
|
uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc
|
2022-11-06 14:19:00 +01:00
|
|
|
with:
|
|
|
|
registry: ghcr.io
|
|
|
|
username: ${{ github.actor }}
|
|
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
2022-11-24 18:42:25 +01:00
|
|
|
- name: Create version file
|
|
|
|
run: make version
|
2022-11-24 03:00:45 +01:00
|
|
|
- name: Create short sha
|
|
|
|
run: echo "SHORT_SHA=${GITHUB_SHA::7}" >> $GITHUB_ENV
|
2023-07-23 23:45:29 +02:00
|
|
|
# The majority of users running arm64 are rpi users, so the rpi
|
|
|
|
# build should be the primary arm64 image
|
2023-07-24 00:22:54 +02:00
|
|
|
- name: Build and push amd64 standard build
|
|
|
|
uses: docker/build-push-action@v4
|
|
|
|
with:
|
|
|
|
context: .
|
|
|
|
file: docker/main/Dockerfile
|
|
|
|
push: true
|
|
|
|
platforms: linux/amd64
|
|
|
|
target: frigate
|
|
|
|
tags: |
|
|
|
|
ghcr.io/${{ steps.lowercaseRepo.outputs.lowercase }}:${{ github.ref_name }}-${{ env.SHORT_SHA }}-amd64
|
|
|
|
cache-from: type=gha
|
|
|
|
cache-to: type=gha,mode=max
|
|
|
|
- name: Build and push arm64 standard build
|
2023-04-15 22:21:23 +02:00
|
|
|
uses: docker/build-push-action@v4
|
2022-11-24 03:00:45 +01:00
|
|
|
with:
|
|
|
|
context: .
|
2023-07-23 23:45:29 +02:00
|
|
|
file: docker/main/Dockerfile
|
2022-11-24 03:00:45 +01:00
|
|
|
push: true
|
2023-07-24 00:22:54 +02:00
|
|
|
platforms: linux/arm64
|
2022-12-30 17:53:17 +01:00
|
|
|
target: frigate
|
2022-11-24 03:00:45 +01:00
|
|
|
tags: |
|
2023-07-24 00:22:54 +02:00
|
|
|
ghcr.io/${{ steps.lowercaseRepo.outputs.lowercase }}:${{ github.ref_name }}-${{ env.SHORT_SHA }}-standard-arm64
|
2022-11-24 03:00:45 +01:00
|
|
|
cache-from: type=gha
|
|
|
|
cache-to: type=gha,mode=max
|
2023-07-23 23:45:29 +02:00
|
|
|
- name: Build and push RPi build
|
|
|
|
uses: docker/bake-action@v3
|
|
|
|
with:
|
|
|
|
push: true
|
|
|
|
targets: rpi
|
|
|
|
files: docker/rpi/rpi.hcl
|
|
|
|
set: |
|
|
|
|
rpi.tags=ghcr.io/${{ steps.lowercaseRepo.outputs.lowercase }}:${{ github.ref_name }}-${{ env.SHORT_SHA }}-rpi
|
|
|
|
*.cache-from=type=gha
|
2022-12-30 17:53:17 +01:00
|
|
|
- name: Build and push TensorRT
|
2023-07-23 23:45:29 +02:00
|
|
|
uses: docker/bake-action@v3
|
2022-12-30 17:53:17 +01:00
|
|
|
with:
|
|
|
|
push: true
|
2023-07-23 23:45:29 +02:00
|
|
|
targets: tensorrt
|
|
|
|
files: docker/tensorrt/trt.hcl
|
|
|
|
set: |
|
|
|
|
tensorrt.tags=ghcr.io/${{ steps.lowercaseRepo.outputs.lowercase }}:${{ github.ref_name }}-${{ env.SHORT_SHA }}-tensorrt
|
|
|
|
*.cache-from=type=gha
|
|
|
|
- name: Assemble and push default build
|
|
|
|
uses: int128/docker-manifest-create-action@v1
|
|
|
|
with:
|
|
|
|
tags: ghcr.io/${{ steps.lowercaseRepo.outputs.lowercase }}:${{ github.ref_name }}-${{ env.SHORT_SHA }}
|
|
|
|
suffixes: |
|
|
|
|
-amd64
|
2023-07-24 00:22:54 +02:00
|
|
|
-rpi
|