Automatic image builds for dev/master (#4260)

* try a different approach for build_web

* add automatic image builds

* build web first

* try disabling log file

* chown dir

* use volume

* set cache path

* test a push

* limit to dev/master branch commits
This commit is contained in:
Blake Blackshear 2022-11-06 07:19:00 -06:00 committed by GitHub
parent 40cb5102b0
commit 9b5c6bea56
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 34 additions and 2 deletions

32
.github/workflows/ci.yml vendored Normal file
View File

@ -0,0 +1,32 @@
name: CI
on:
push:
branches:
- dev
- master
env:
PYTHON_VERSION: 3.9
jobs:
multi_arch_build:
runs-on: ubuntu-latest
name: Image Build
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Log in to the Container registry
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build web
run: make build_web
- name: Build image
run: make push

View File

@ -9,7 +9,7 @@ version:
echo "VERSION=\"$(VERSION)-$(COMMIT_HASH)\"" > frigate/version.py echo "VERSION=\"$(VERSION)-$(COMMIT_HASH)\"" > frigate/version.py
build_web: build_web:
docker run --volume ${PWD}/web:/web -w /web --volume /etc/passwd:/etc/passwd:ro --volume /etc/group:/etc/group:ro -u $(CURRENT_UID):$(CURRENT_GID) node:16 /bin/bash -c "npm install && npm run build" docker run -e npm_config_cache=/web/.npm --volume ${PWD}/web:/web -w /web --group-add $(CURRENT_GID) -u $(CURRENT_UID):$(CURRENT_GID) node:16 /bin/bash -c "npm install && npm run build"
nginx_frigate: nginx_frigate:
docker buildx build --push --platform linux/arm/v7,linux/arm64/v8,linux/amd64 --tag blakeblackshear/frigate-nginx:1.0.2 --file docker/Dockerfile.nginx . docker buildx build --push --platform linux/arm/v7,linux/arm64/v8,linux/amd64 --tag blakeblackshear/frigate-nginx:1.0.2 --file docker/Dockerfile.nginx .
@ -30,7 +30,7 @@ build: version amd64 arm64 armv7
docker buildx build --platform linux/arm/v7,linux/arm64/v8,linux/amd64 --tag blakeblackshear/frigate:$(VERSION)-$(COMMIT_HASH) --file docker/Dockerfile . docker buildx build --platform linux/arm/v7,linux/arm64/v8,linux/amd64 --tag blakeblackshear/frigate:$(VERSION)-$(COMMIT_HASH) --file docker/Dockerfile .
push: build push: build
docker buildx build --push --platform linux/arm/v7,linux/arm64/v8,linux/amd64 --tag blakeblackshear/frigate:$(VERSION)-$(COMMIT_HASH) --file docker/Dockerfile . docker buildx build --push --platform linux/arm/v7,linux/arm64/v8,linux/amd64 --tag ghcr.io/blakeblackshear/frigate:${GITHUB_REF_NAME}-$(COMMIT_HASH) --file docker/Dockerfile .
run_tests: frigate run_tests: frigate
docker run --rm --entrypoint=python3 frigate:latest -u -m unittest docker run --rm --entrypoint=python3 frigate:latest -u -m unittest