From 8573016bef4a61e3a324697dbd6155440aff0f21 Mon Sep 17 00:00:00 2001 From: gtsiam Date: Tue, 17 Sep 2024 15:39:44 +0300 Subject: [PATCH] Formatting improvements (#13765) * Format makefiles * Handle all errors in rocm makefile * Remove CURRENT_UID and GID from makefile as they are unused * Removed unused vite.svg asset * Sort frigate-dictionary --- .cspell/frigate-dictionary.txt | 323 ++++++++++++++++----------------- Makefile | 29 ++- docker/hailo8l/h8l.mk | 11 +- docker/rockchip/rk.mk | 11 +- docker/rocm/rocm.mk | 48 ++++- docker/rpi/rpi.mk | 11 +- docker/tensorrt/trt.mk | 33 +++- web/public/vite.svg | 1 - 8 files changed, 271 insertions(+), 196 deletions(-) delete mode 100644 web/public/vite.svg diff --git a/.cspell/frigate-dictionary.txt b/.cspell/frigate-dictionary.txt index 397584bd9..3f10ab6ff 100644 --- a/.cspell/frigate-dictionary.txt +++ b/.cspell/frigate-dictionary.txt @@ -1,168 +1,167 @@ -rtmp -edgetpu -labelmap -rockchip -jetson -rocm -vaapi -CUDA -hwaccel -RTSP -Hikvision -Dahua -Amcrest -Reolink -Loryta -Beelink -Celeron -vaapi -blakeblackshear -workdir -onvif -autotracking -openvino -tflite -deepstack -codeproject -udev -tailscale -restream -restreaming -webrtc -ssdlite -mobilenet -mosquitto -datasheet -Jellyfin -Radeon -libva -Ubiquiti -Unifi -Tapo -Annke -autotracker -autotracked -variations -ONVIF -traefik -devcontainer -rootfs -ffprobe -autotrack -logpipe -imread -imwrite -imencode -imutils -thresholded -timelapse -ultrafast -sleeptime -radeontop -vainfo -tmpfs -homography -websockets -LIBAVFORMAT -NTSC -onnxruntime -fourcc -radeonsi -paho -imagestream -jsonify -cgroups -sysconf -memlimit -gpuload -nvml -setproctitle -psutil -Kalman -frontdoor -namedtuples -zeep -fflags -probesize -wallclock -rknn -socs -pydantic -shms -imdecode -colormap -webui -mse -jsmpeg -unreviewed -Chromecast -Swipeable -flac -scroller -cmdline -toggleable -bottombar -opencv -apexcharts -buildx -mqtt -rawvideo -defragment -Norfair -subclassing -yolo -tensorrt -blackshear -stylelint -HACS -homeassistant -hass -castable -mobiledet -framebuffer -mjpeg -substream -codeowner -noninteractive -restreamed -mountpoint -fstype -OWASP -iotop -letsencrypt -fullchain -lsusb -iostat -usermod -balena -passwordless -debconf -dpkg -poweroff -surveillance -qnap -homekit -colorspace -quantisation -skylake -Cuvid -foscam -onnx -numpy -protobuf aarch +Amcrest amdgpu -chipset -referer -mpegts -webp +Annke +apexcharts authelia authentik -unichip -rebranded -udevadm automations -unraid -hideable +autotrack +autotracked +autotracker +autotracking +balena +Beelink +blackshear +blakeblackshear +bottombar +buildx +castable +Celeron +cgroups +chipset +Chromecast +cmdline +codeowner +codeproject +colormap +colorspace +CUDA +Cuvid +Dahua +datasheet +debconf +deepstack +defragment +devcontainer +dpkg +edgetpu +fflags +ffprobe +flac +foscam +fourcc +framebuffer +frontdoor +fstype +fullchain +gpuload +HACS +hass healthcheck -keepalive \ No newline at end of file +hideable +Hikvision +homeassistant +homekit +homography +hwaccel +imagestream +imdecode +imencode +imread +imutils +imwrite +iostat +iotop +Jellyfin +jetson +jsmpeg +jsonify +Kalman +keepalive +labelmap +letsencrypt +LIBAVFORMAT +libva +logpipe +Loryta +lsusb +memlimit +mjpeg +mobiledet +mobilenet +mosquitto +mountpoint +mpegts +mqtt +mse +namedtuples +noninteractive +Norfair +NTSC +numpy +nvml +onnx +onnxruntime +onvif +ONVIF +opencv +openvino +OWASP +paho +passwordless +poweroff +probesize +protobuf +psutil +pydantic +qnap +quantisation +Radeon +radeonsi +radeontop +rawvideo +rebranded +referer +Reolink +restream +restreamed +restreaming +rknn +rockchip +rocm +rootfs +rtmp +RTSP +scroller +setproctitle +shms +skylake +sleeptime +socs +ssdlite +stylelint +subclassing +substream +surveillance +Swipeable +sysconf +tailscale +Tapo +tensorrt +tflite +thresholded +timelapse +tmpfs +toggleable +traefik +Ubiquiti +udev +udevadm +ultrafast +unichip +Unifi +unraid +unreviewed +usermod +vaapi +vainfo +variations +wallclock +webp +webrtc +websockets +webui +workdir +yolo +zeep diff --git a/Makefile b/Makefile index 8ff6231b7..b7c6ab821 100644 --- a/Makefile +++ b/Makefile @@ -4,8 +4,6 @@ COMMIT_HASH := $(shell git log -1 --pretty=format:"%h"|tail -1) VERSION = 0.15.0 IMAGE_REPO ?= ghcr.io/blakeblackshear/frigate GITHUB_REF_NAME ?= $(shell git rev-parse --abbrev-ref HEAD) -CURRENT_UID := $(shell id -u) -CURRENT_GID := $(shell id -g) BOARDS= #Initialized empty include docker/*/*.mk @@ -18,25 +16,38 @@ version: echo 'VERSION = "$(VERSION)-$(COMMIT_HASH)"' > frigate/version.py local: version - docker buildx build --target=frigate --tag frigate:latest --load --file docker/main/Dockerfile . + docker buildx build --target=frigate --file docker/main/Dockerfile . \ + --tag frigate:latest \ + --load amd64: - docker buildx build --platform linux/amd64 --target=frigate --tag $(IMAGE_REPO):$(VERSION)-$(COMMIT_HASH) --file docker/main/Dockerfile . + docker buildx build --target=frigate --file docker/main/Dockerfile . \ + --tag $(IMAGE_REPO):$(VERSION)-$(COMMIT_HASH) \ + --platform linux/amd64 arm64: - docker buildx build --platform linux/arm64 --target=frigate --tag $(IMAGE_REPO):$(VERSION)-$(COMMIT_HASH) --file docker/main/Dockerfile . + docker buildx build --target=frigate --file docker/main/Dockerfile . \ + --tag $(IMAGE_REPO):$(VERSION)-$(COMMIT_HASH) \ + --platform linux/arm64 build: version amd64 arm64 - docker buildx build --platform linux/arm64/v8,linux/amd64 --target=frigate --tag $(IMAGE_REPO):$(VERSION)-$(COMMIT_HASH) --file docker/main/Dockerfile . + docker buildx build --target=frigate --file docker/main/Dockerfile . \ + --tag $(IMAGE_REPO):$(VERSION)-$(COMMIT_HASH) \ + --platform linux/arm64/v8,linux/amd64 push: push-boards - docker buildx build --push --platform linux/arm64/v8,linux/amd64 --target=frigate --tag $(IMAGE_REPO):${GITHUB_REF_NAME}-$(COMMIT_HASH) --file docker/main/Dockerfile . + docker buildx build --target=frigate --file docker/main/Dockerfile . \ + --tag $(IMAGE_REPO):${GITHUB_REF_NAME}-$(COMMIT_HASH) \ + --platform linux/arm64/v8,linux/amd64 \ + --push run: local docker run --rm --publish=5000:5000 --volume=${PWD}/config:/config frigate:latest run_tests: local - docker run --rm --workdir=/opt/frigate --entrypoint= frigate:latest python3 -u -m unittest - docker run --rm --workdir=/opt/frigate --entrypoint= frigate:latest python3 -u -m mypy --config-file frigate/mypy.ini frigate + docker run --rm --workdir=/opt/frigate --entrypoint= frigate:latest \ + python3 -u -m unittest + docker run --rm --workdir=/opt/frigate --entrypoint= frigate:latest \ + python3 -u -m mypy --config-file frigate/mypy.ini frigate .PHONY: run_tests diff --git a/docker/hailo8l/h8l.mk b/docker/hailo8l/h8l.mk index 8d8a5d00f..318771802 100644 --- a/docker/hailo8l/h8l.mk +++ b/docker/hailo8l/h8l.mk @@ -1,10 +1,15 @@ BOARDS += h8l local-h8l: version - docker buildx bake --load --file=docker/hailo8l/h8l.hcl --set h8l.tags=frigate:latest-h8l h8l + docker buildx bake --file=docker/hailo8l/h8l.hcl h8l \ + --set h8l.tags=frigate:latest-h8l \ + --load build-h8l: version - docker buildx bake --file=docker/hailo8l/h8l.hcl --set h8l.tags=$(IMAGE_REPO):${GITHUB_REF_NAME}-$(COMMIT_HASH)-h8l h8l + docker buildx bake --file=docker/hailo8l/h8l.hcl h8l \ + --set h8l.tags=$(IMAGE_REPO):${GITHUB_REF_NAME}-$(COMMIT_HASH)-h8l push-h8l: build-h8l - docker buildx bake --push --file=docker/hailo8l/h8l.hcl --set h8l.tags=$(IMAGE_REPO):${GITHUB_REF_NAME}-$(COMMIT_HASH)-h8l h8l \ No newline at end of file + docker buildx bake --file=docker/hailo8l/h8l.hcl h8l \ + --set h8l.tags=$(IMAGE_REPO):${GITHUB_REF_NAME}-$(COMMIT_HASH)-h8l \ + --push \ No newline at end of file diff --git a/docker/rockchip/rk.mk b/docker/rockchip/rk.mk index 0d9bde16a..c8278f68b 100644 --- a/docker/rockchip/rk.mk +++ b/docker/rockchip/rk.mk @@ -1,10 +1,15 @@ BOARDS += rk local-rk: version - docker buildx bake --load --file=docker/rockchip/rk.hcl --set rk.tags=frigate:latest-rk rk + docker buildx bake --file=docker/rockchip/rk.hcl rk \ + --set rk.tags=frigate:latest-rk \ + --load build-rk: version - docker buildx bake --file=docker/rockchip/rk.hcl --set rk.tags=$(IMAGE_REPO):${GITHUB_REF_NAME}-$(COMMIT_HASH)-rk rk + docker buildx bake --file=docker/rockchip/rk.hcl rk \ + --set rk.tags=$(IMAGE_REPO):${GITHUB_REF_NAME}-$(COMMIT_HASH)-rk push-rk: build-rk - docker buildx bake --push --file=docker/rockchip/rk.hcl --set rk.tags=$(IMAGE_REPO):${GITHUB_REF_NAME}-$(COMMIT_HASH)-rk rk \ No newline at end of file + docker buildx bake --file=docker/rockchip/rk.hcl rk \ + --set rk.tags=$(IMAGE_REPO):${GITHUB_REF_NAME}-$(COMMIT_HASH)-rk \ + --push \ No newline at end of file diff --git a/docker/rocm/rocm.mk b/docker/rocm/rocm.mk index 2d3d034ee..c92a458f5 100644 --- a/docker/rocm/rocm.mk +++ b/docker/rocm/rocm.mk @@ -4,14 +4,50 @@ BOARDS += rocm ROCM_CHIPSETS:=gfx900:9.0.0 gfx1030:10.3.0 gfx1100:11.0.0 local-rocm: version - $(foreach chipset,$(ROCM_CHIPSETS),AMDGPU=$(word 1,$(subst :, ,$(chipset))) HSA_OVERRIDE_GFX_VERSION=$(word 2,$(subst :, ,$(chipset))) HSA_OVERRIDE=1 docker buildx bake --load --file=docker/rocm/rocm.hcl --set rocm.tags=frigate:latest-rocm-$(word 1,$(subst :, ,$(chipset))) rocm;) - unset HSA_OVERRIDE_GFX_VERSION && HSA_OVERRIDE=0 AMDGPU=gfx docker buildx bake --load --file=docker/rocm/rocm.hcl --set rocm.tags=frigate:latest-rocm rocm + $(foreach chipset,$(ROCM_CHIPSETS), \ + AMDGPU=$(word 1,$(subst :, ,$(chipset))) \ + HSA_OVERRIDE_GFX_VERSION=$(word 2,$(subst :, ,$(chipset))) \ + HSA_OVERRIDE=1 \ + docker buildx bake --file=docker/rocm/rocm.hcl rocm \ + --set rocm.tags=frigate:latest-rocm-$(word 1,$(subst :, ,$(chipset))) \ + --load \ + &&) true + + unset HSA_OVERRIDE_GFX_VERSION && \ + HSA_OVERRIDE=0 \ + AMDGPU=gfx \ + docker buildx bake --file=docker/rocm/rocm.hcl rocm \ + --set rocm.tags=frigate:latest-rocm \ + --load build-rocm: version - $(foreach chipset,$(ROCM_CHIPSETS),AMDGPU=$(word 1,$(subst :, ,$(chipset))) HSA_OVERRIDE_GFX_VERSION=$(word 2,$(subst :, ,$(chipset))) HSA_OVERRIDE=1 docker buildx bake --file=docker/rocm/rocm.hcl --set rocm.tags=$(IMAGE_REPO):${GITHUB_REF_NAME}-$(COMMIT_HASH)-rocm-$(chipset) rocm;) - unset HSA_OVERRIDE_GFX_VERSION && HSA_OVERRIDE=0 AMDGPU=gfx docker buildx bake --file=docker/rocm/rocm.hcl --set rocm.tags=$(IMAGE_REPO):${GITHUB_REF_NAME}-$(COMMIT_HASH)-rocm rocm + $(foreach chipset,$(ROCM_CHIPSETS), \ + AMDGPU=$(word 1,$(subst :, ,$(chipset))) \ + HSA_OVERRIDE_GFX_VERSION=$(word 2,$(subst :, ,$(chipset))) \ + HSA_OVERRIDE=1 \ + docker buildx bake --file=docker/rocm/rocm.hcl rocm \ + --set rocm.tags=$(IMAGE_REPO):${GITHUB_REF_NAME}-$(COMMIT_HASH)-rocm-$(chipset) \ + &&) true + + unset HSA_OVERRIDE_GFX_VERSION && \ + HSA_OVERRIDE=0 \ + AMDGPU=gfx \ + docker buildx bake --file=docker/rocm/rocm.hcl rocm \ + --set rocm.tags=$(IMAGE_REPO):${GITHUB_REF_NAME}-$(COMMIT_HASH)-rocm push-rocm: build-rocm - $(foreach chipset,$(ROCM_CHIPSETS),AMDGPU=$(word 1,$(subst :, ,$(chipset))) HSA_OVERRIDE_GFX_VERSION=$(word 2,$(subst :, ,$(chipset))) HSA_OVERRIDE=1 docker buildx bake --push --file=docker/rocm/rocm.hcl --set rocm.tags=$(IMAGE_REPO):${GITHUB_REF_NAME}-$(COMMIT_HASH)-rocm-$(chipset) rocm;) - unset HSA_OVERRIDE_GFX_VERSION && HSA_OVERRIDE=0 AMDGPU=gfx docker buildx bake --push --file=docker/rocm/rocm.hcl --set rocm.tags=$(IMAGE_REPO):${GITHUB_REF_NAME}-$(COMMIT_HASH)-rocm rocm + $(foreach chipset,$(ROCM_CHIPSETS), \ + AMDGPU=$(word 1,$(subst :, ,$(chipset))) \ + HSA_OVERRIDE_GFX_VERSION=$(word 2,$(subst :, ,$(chipset))) \ + HSA_OVERRIDE=1 \ + docker buildx bake --file=docker/rocm/rocm.hcl rocm \ + --set rocm.tags=$(IMAGE_REPO):${GITHUB_REF_NAME}-$(COMMIT_HASH)-rocm-$(chipset) \ + --push \ + &&) true + unset HSA_OVERRIDE_GFX_VERSION && \ + HSA_OVERRIDE=0 \ + AMDGPU=gfx \ + docker buildx bake --file=docker/rocm/rocm.hcl rocm \ + --set rocm.tags=$(IMAGE_REPO):${GITHUB_REF_NAME}-$(COMMIT_HASH)-rocm \ + --push diff --git a/docker/rpi/rpi.mk b/docker/rpi/rpi.mk index c1282b011..290b30c31 100644 --- a/docker/rpi/rpi.mk +++ b/docker/rpi/rpi.mk @@ -1,10 +1,15 @@ BOARDS += rpi local-rpi: version - docker buildx bake --load --file=docker/rpi/rpi.hcl --set rpi.tags=frigate:latest-rpi rpi + docker buildx bake --file=docker/rpi/rpi.hcl rpi \ + --set rpi.tags=frigate:latest-rpi \ + --load build-rpi: version - docker buildx bake --file=docker/rpi/rpi.hcl --set rpi.tags=$(IMAGE_REPO):${GITHUB_REF_NAME}-$(COMMIT_HASH)-rpi rpi + docker buildx bake --file=docker/rpi/rpi.hcl rpi \ + --set rpi.tags=$(IMAGE_REPO):${GITHUB_REF_NAME}-$(COMMIT_HASH)-rpi push-rpi: build-rpi - docker buildx bake --push --file=docker/rpi/rpi.hcl --set rpi.tags=$(IMAGE_REPO):${GITHUB_REF_NAME}-$(COMMIT_HASH)-rpi rpi \ No newline at end of file + docker buildx bake --file=docker/rpi/rpi.hcl rpi \ + --set rpi.tags=$(IMAGE_REPO):${GITHUB_REF_NAME}-$(COMMIT_HASH)-rpi \ + --push diff --git a/docker/tensorrt/trt.mk b/docker/tensorrt/trt.mk index ad2425c81..455e1ee11 100644 --- a/docker/tensorrt/trt.mk +++ b/docker/tensorrt/trt.mk @@ -7,20 +7,35 @@ JETPACK4_ARGS := ARCH=arm64 BASE_IMAGE=$(JETPACK4_BASE) SLIM_BASE=$(JETPACK4_BAS JETPACK5_ARGS := ARCH=arm64 BASE_IMAGE=$(JETPACK5_BASE) SLIM_BASE=$(JETPACK5_BASE) TRT_BASE=$(JETPACK5_BASE) local-trt: version - $(X86_DGPU_ARGS) docker buildx bake --load --file=docker/tensorrt/trt.hcl --set tensorrt.tags=frigate:latest-tensorrt tensorrt + $(X86_DGPU_ARGS) docker buildx bake --file=docker/tensorrt/trt.hcl tensorrt \ + --set tensorrt.tags=frigate:latest-tensorrt \ + --load local-trt-jp4: version - $(JETPACK4_ARGS) docker buildx bake --load --file=docker/tensorrt/trt.hcl --set tensorrt.tags=frigate:latest-tensorrt-jp4 tensorrt + $(JETPACK4_ARGS) docker buildx bake --file=docker/tensorrt/trt.hcl tensorrt \ + --set tensorrt.tags=frigate:latest-tensorrt-jp4 \ + --load local-trt-jp5: version - $(JETPACK5_ARGS) docker buildx bake --load --file=docker/tensorrt/trt.hcl --set tensorrt.tags=frigate:latest-tensorrt-jp5 tensorrt + $(JETPACK5_ARGS) docker buildx bake --file=docker/tensorrt/trt.hcl tensorrt \ + --set tensorrt.tags=frigate:latest-tensorrt-jp5 \ + --load build-trt: - $(X86_DGPU_ARGS) docker buildx bake --file=docker/tensorrt/trt.hcl --set tensorrt.tags=$(IMAGE_REPO):${GITHUB_REF_NAME}-$(COMMIT_HASH)-tensorrt tensorrt - $(JETPACK4_ARGS) docker buildx bake --file=docker/tensorrt/trt.hcl --set tensorrt.tags=$(IMAGE_REPO):${GITHUB_REF_NAME}-$(COMMIT_HASH)-tensorrt-jp4 tensorrt - $(JETPACK5_ARGS) docker buildx bake --file=docker/tensorrt/trt.hcl --set tensorrt.tags=$(IMAGE_REPO):${GITHUB_REF_NAME}-$(COMMIT_HASH)-tensorrt-jp5 tensorrt + $(X86_DGPU_ARGS) docker buildx bake --file=docker/tensorrt/trt.hcl tensorrt \ + --set tensorrt.tags=$(IMAGE_REPO):${GITHUB_REF_NAME}-$(COMMIT_HASH)-tensorrt + $(JETPACK4_ARGS) docker buildx bake --file=docker/tensorrt/trt.hcl tensorrt \ + --set tensorrt.tags=$(IMAGE_REPO):${GITHUB_REF_NAME}-$(COMMIT_HASH)-tensorrt-jp4 + $(JETPACK5_ARGS) docker buildx bake --file=docker/tensorrt/trt.hcl tensorrt \ + --set tensorrt.tags=$(IMAGE_REPO):${GITHUB_REF_NAME}-$(COMMIT_HASH)-tensorrt-jp5 push-trt: build-trt - $(X86_DGPU_ARGS) docker buildx bake --push --file=docker/tensorrt/trt.hcl --set tensorrt.tags=$(IMAGE_REPO):${GITHUB_REF_NAME}-$(COMMIT_HASH)-tensorrt tensorrt - $(JETPACK4_ARGS) docker buildx bake --push --file=docker/tensorrt/trt.hcl --set tensorrt.tags=$(IMAGE_REPO):${GITHUB_REF_NAME}-$(COMMIT_HASH)-tensorrt-jp4 tensorrt - $(JETPACK5_ARGS) docker buildx bake --push --file=docker/tensorrt/trt.hcl --set tensorrt.tags=$(IMAGE_REPO):${GITHUB_REF_NAME}-$(COMMIT_HASH)-tensorrt-jp5 tensorrt + $(X86_DGPU_ARGS) docker buildx bake --file=docker/tensorrt/trt.hcl tensorrt \ + --set tensorrt.tags=$(IMAGE_REPO):${GITHUB_REF_NAME}-$(COMMIT_HASH)-tensorrt \ + --push + $(JETPACK4_ARGS) docker buildx bake --file=docker/tensorrt/trt.hcl tensorrt \ + --set tensorrt.tags=$(IMAGE_REPO):${GITHUB_REF_NAME}-$(COMMIT_HASH)-tensorrt-jp4 \ + --push + $(JETPACK5_ARGS) docker buildx bake --file=docker/tensorrt/trt.hcl tensorrt \ + --set tensorrt.tags=$(IMAGE_REPO):${GITHUB_REF_NAME}-$(COMMIT_HASH)-tensorrt-jp5 \ + --push diff --git a/web/public/vite.svg b/web/public/vite.svg deleted file mode 100644 index e7b8dfb1b..000000000 --- a/web/public/vite.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file