Skip to content

Commit

Permalink
Automatic image builds for dev/master (#4260)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
blakeblackshear authored Nov 6, 2022
1 parent 40cb510 commit 9b5c6be
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 2 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ version:
echo "VERSION=\"$(VERSION)-$(COMMIT_HASH)\"" > frigate/version.py

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:
docker buildx build --push --platform linux/arm/v7,linux/arm64/v8,linux/amd64 --tag blakeblackshear/frigate-nginx:1.0.2 --file docker/Dockerfile.nginx .
Expand All @@ -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 .

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
docker run --rm --entrypoint=python3 frigate:latest -u -m unittest
Expand Down

0 comments on commit 9b5c6be

Please sign in to comment.