mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-05 18:55:23 +03:00
Setup to use docker bake
This commit is contained in:
parent
0e434e7cb5
commit
50b6b925a4
10
Makefile
10
Makefile
@ -18,19 +18,19 @@ version:
|
|||||||
echo 'VERSION = "$(VERSION)-$(COMMIT_HASH)"' > frigate/version.py
|
echo 'VERSION = "$(VERSION)-$(COMMIT_HASH)"' > frigate/version.py
|
||||||
|
|
||||||
local: version
|
local: version
|
||||||
docker buildx build --target=frigate --tag frigate:latest --load --file docker/build/main/Dockerfile .
|
docker buildx build --target=frigate --tag frigate:latest --load --file docker/main/Dockerfile .
|
||||||
|
|
||||||
amd64:
|
amd64:
|
||||||
docker buildx build --platform linux/amd64 --target=frigate --tag $(IMAGE_REPO):$(VERSION)-$(COMMIT_HASH) --file docker/build/main/Dockerfile .
|
docker buildx build --platform linux/amd64 --target=frigate --tag $(IMAGE_REPO):$(VERSION)-$(COMMIT_HASH) --file docker/main/Dockerfile .
|
||||||
|
|
||||||
arm64:
|
arm64:
|
||||||
docker buildx build --platform linux/arm64 --target=frigate --tag $(IMAGE_REPO):$(VERSION)-$(COMMIT_HASH) --file docker/build/main/Dockerfile .
|
docker buildx build --platform linux/arm64 --target=frigate --tag $(IMAGE_REPO):$(VERSION)-$(COMMIT_HASH) --file docker/main/Dockerfile .
|
||||||
|
|
||||||
build: version amd64 arm64
|
build: version amd64 arm64
|
||||||
docker buildx build --platform linux/arm64/v8,linux/amd64 --target=frigate --tag $(IMAGE_REPO):$(VERSION)-$(COMMIT_HASH) --file docker/build/main/Dockerfile .
|
docker buildx build --platform linux/arm64/v8,linux/amd64 --target=frigate --tag $(IMAGE_REPO):$(VERSION)-$(COMMIT_HASH) --file docker/main/Dockerfile .
|
||||||
|
|
||||||
push: push-boards
|
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/build/main/Dockerfile .
|
docker buildx build --push --platform linux/arm64/v8,linux/amd64 --target=frigate --tag $(IMAGE_REPO):${GITHUB_REF_NAME}-$(COMMIT_HASH) --file docker/main/Dockerfile .
|
||||||
|
|
||||||
run: local
|
run: local
|
||||||
docker run --rm --publish=5000:5000 --volume=${PWD}/config:/config frigate:latest
|
docker run --rm --publish=5000:5000 --volume=${PWD}/config:/config frigate:latest
|
||||||
|
|||||||
@ -1,3 +1,5 @@
|
|||||||
|
# syntax=docker/dockerfile:1.4
|
||||||
|
|
||||||
# https://askubuntu.com/questions/972516/debian-frontend-environment-variable
|
# https://askubuntu.com/questions/972516/debian-frontend-environment-variable
|
||||||
ARG DEBIAN_FRONTEND=noninteractive
|
ARG DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
@ -32,6 +34,32 @@ RUN wget -qO go2rtc "https://github.com/AlexxIT/go2rtc/releases/download/v1.6.0/
|
|||||||
&& chmod +x go2rtc
|
&& chmod +x go2rtc
|
||||||
|
|
||||||
|
|
||||||
|
####
|
||||||
|
#
|
||||||
|
# OpenVino Support
|
||||||
|
#
|
||||||
|
# 1. Download and convert a model from Intel's Public Open Model Zoo
|
||||||
|
# 2. Build libUSB without udev to handle NCS2 enumeration
|
||||||
|
#
|
||||||
|
####
|
||||||
|
# Download and Convert OpenVino model
|
||||||
|
FROM base_amd64 AS ov-converter
|
||||||
|
ARG DEBIAN_FRONTEND
|
||||||
|
|
||||||
|
# Install OpenVino Runtime and Dev library
|
||||||
|
COPY requirements-ov.txt /requirements-ov.txt
|
||||||
|
RUN apt-get -qq update \
|
||||||
|
&& apt-get -qq install -y wget python3 python3-distutils \
|
||||||
|
&& wget -q https://bootstrap.pypa.io/get-pip.py -O get-pip.py \
|
||||||
|
&& python3 get-pip.py "pip" \
|
||||||
|
&& pip install -r /requirements-ov.txt
|
||||||
|
|
||||||
|
# Get OpenVino Model
|
||||||
|
RUN mkdir /models \
|
||||||
|
&& cd /models && omz_downloader --name ssdlite_mobilenet_v2 \
|
||||||
|
&& cd /models && omz_converter --name ssdlite_mobilenet_v2 --precision FP16
|
||||||
|
|
||||||
|
|
||||||
# libUSB - No Udev
|
# libUSB - No Udev
|
||||||
FROM wget as libusb-build
|
FROM wget as libusb-build
|
||||||
ARG TARGETARCH
|
ARG TARGETARCH
|
||||||
@ -66,6 +94,10 @@ FROM wget AS models
|
|||||||
RUN wget -qO edgetpu_model.tflite https://github.com/google-coral/test_data/raw/release-frogfish/ssdlite_mobiledet_coco_qat_postprocess_edgetpu.tflite
|
RUN wget -qO edgetpu_model.tflite https://github.com/google-coral/test_data/raw/release-frogfish/ssdlite_mobiledet_coco_qat_postprocess_edgetpu.tflite
|
||||||
RUN wget -qO cpu_model.tflite https://github.com/google-coral/test_data/raw/release-frogfish/ssdlite_mobiledet_coco_qat_postprocess.tflite
|
RUN wget -qO cpu_model.tflite https://github.com/google-coral/test_data/raw/release-frogfish/ssdlite_mobiledet_coco_qat_postprocess.tflite
|
||||||
COPY labelmap.txt .
|
COPY labelmap.txt .
|
||||||
|
# Copy OpenVino model
|
||||||
|
COPY --from=ov-converter /models/public/ssdlite_mobilenet_v2/FP16 openvino-model
|
||||||
|
RUN wget -q https://github.com/openvinotoolkit/open_model_zoo/raw/master/data/dataset_classes/coco_91cl_bkgr.txt -O openvino-model/coco_91cl_bkgr.txt && \
|
||||||
|
sed -i 's/truck/car/g' openvino-model/coco_91cl_bkgr.txt
|
||||||
# Get Audio Model and labels
|
# Get Audio Model and labels
|
||||||
RUN wget -qO cpu_audio_model.tflite https://tfhub.dev/google/lite-model/yamnet/classification/tflite/1?lite-format=tflite
|
RUN wget -qO cpu_audio_model.tflite https://tfhub.dev/google/lite-model/yamnet/classification/tflite/1?lite-format=tflite
|
||||||
COPY audio-labelmap.txt .
|
COPY audio-labelmap.txt .
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
# syntax = edrevo/dockerfile-plus
|
# syntax=docker/dockerfile:1.4
|
||||||
INCLUDE+ docker/main/Dockerfile
|
|
||||||
|
|
||||||
# https://askubuntu.com/questions/972516/debian-frontend-environment-variable
|
# https://askubuntu.com/questions/972516/debian-frontend-environment-variable
|
||||||
ARG DEBIAN_FRONTEND=noninteractive
|
ARG DEBIAN_FRONTEND=noninteractive
|
||||||
|
|||||||
18
docker/rpi/bake.hcl
Normal file
18
docker/rpi/bake.hcl
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
target "deps" {
|
||||||
|
dockerfile = "docker/main/Dockerfile"
|
||||||
|
platforms = ["linux/arm64"]
|
||||||
|
}
|
||||||
|
|
||||||
|
target rootfs {
|
||||||
|
dockerfile = "docker/main/Dockerfile"
|
||||||
|
platforms = ["linux/arm64"]
|
||||||
|
}
|
||||||
|
|
||||||
|
target "rpi" {
|
||||||
|
dockerfile = "docker/rpi/Dockerfile"
|
||||||
|
contexts = {
|
||||||
|
deps = "target:deps",
|
||||||
|
rootfs = "target:rootfs"
|
||||||
|
}
|
||||||
|
platforms = ["linux/arm64"]
|
||||||
|
}
|
||||||
@ -2,6 +2,19 @@
|
|||||||
|
|
||||||
set -euxo pipefail
|
set -euxo pipefail
|
||||||
|
|
||||||
|
apt-get -qq update
|
||||||
|
|
||||||
|
apt-get -qq install --no-install-recommends -y \
|
||||||
|
apt-transport-https \
|
||||||
|
gnupg \
|
||||||
|
wget \
|
||||||
|
procps vainfo \
|
||||||
|
unzip locales tzdata libxml2 xz-utils \
|
||||||
|
python3-pip \
|
||||||
|
curl \
|
||||||
|
jq \
|
||||||
|
nethogs
|
||||||
|
|
||||||
mkdir -p -m 600 /root/.gnupg
|
mkdir -p -m 600 /root/.gnupg
|
||||||
|
|
||||||
# enable non-free repo
|
# enable non-free repo
|
||||||
|
|||||||
@ -1,10 +1,10 @@
|
|||||||
BOARDS += rpi
|
BOARDS += rpi
|
||||||
|
|
||||||
local-rpi: version
|
local-rpi: version
|
||||||
docker buildx build --tag frigate:latest-rpi --load --file docker/build/rpi/Dockerfile .
|
docker buildx bake --file=docker/rpi/bake.hcl --set rpi.tagsfrigate:latest-rpi rpi
|
||||||
|
|
||||||
build-rpi:
|
build-rpi: version
|
||||||
docker buildx build --platform linux/arm64 --tag $(IMAGE_REPO):${VERSION}-$(COMMIT_HASH)-rpi --file docker/build/rpi/Dockerfile .
|
docker buildx bake --file=docker/rpi/bake.hcl --set rpi.tags=$(IMAGE_REPO):${GITHUB_REF_NAME}-$(COMMIT_HASH)-rpi rpi
|
||||||
|
|
||||||
push-rpi: build-rpi
|
push-rpi: build-rpi
|
||||||
docker buildx build --push --platform linux/arm64 --tag $(IMAGE_REPO):${GITHUB_REF_NAME}-$(COMMIT_HASH)-rpi --file docker/build/rpi/Dockerfile .
|
docker buildx bake --push --file=docker/rpi/bake.hcl --set rpi.tags=$(IMAGE_REPO):${GITHUB_REF_NAME}-$(COMMIT_HASH)-rpi rpi
|
||||||
@ -1,5 +1,4 @@
|
|||||||
# syntax = edrevo/dockerfile-plus
|
# syntax=docker/dockerfile:1.2
|
||||||
INCLUDE+ docker/main/Dockerfile
|
|
||||||
|
|
||||||
# https://askubuntu.com/questions/972516/debian-frontend-environment-variable
|
# https://askubuntu.com/questions/972516/debian-frontend-environment-variable
|
||||||
ARG DEBIAN_FRONTEND=noninteractive
|
ARG DEBIAN_FRONTEND=noninteractive
|
||||||
|
|||||||
18
docker/tensorrt/bake.hcl
Normal file
18
docker/tensorrt/bake.hcl
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
target "deps" {
|
||||||
|
dockerfile = "docker/main/Dockerfile"
|
||||||
|
platforms = ["linux/amd64"]
|
||||||
|
}
|
||||||
|
|
||||||
|
target rootfs {
|
||||||
|
dockerfile = "docker/main/Dockerfile"
|
||||||
|
platforms = ["linux/amd64"]
|
||||||
|
}
|
||||||
|
|
||||||
|
target "tensorrt" {
|
||||||
|
dockerfile = "docker/tensorrt/Dockerfile"
|
||||||
|
contexts = {
|
||||||
|
deps = "target:deps",
|
||||||
|
rootfs = "target:rootfs"
|
||||||
|
}
|
||||||
|
platforms = ["linux/amd64"]
|
||||||
|
}
|
||||||
@ -1,10 +1,10 @@
|
|||||||
BOARDS += trt
|
BOARDS += trt
|
||||||
|
|
||||||
local-trt: version
|
local-trt: version
|
||||||
docker buildx build --tag frigate:latest-tensorrt --load --file docker/build/tensorrt/Dockerfile .
|
docker buildx bake --file=docker/rpi/bake.hcl --set rpi.tagsfrigate:latest-tensorrt tensorrt
|
||||||
|
|
||||||
build-trt:
|
build-trt:
|
||||||
docker buildx build --platform linux/amd64 --tag $(IMAGE_REPO):${VERSION}-$(COMMIT_HASH)-tensorrt --file docker/build/trt/Dockerfile .
|
docker buildx bake --file=docker/rpi/bake.hcl --set rpi.tags=$(IMAGE_REPO):${GITHUB_REF_NAME}-$(COMMIT_HASH)-tensorrt tensorrt
|
||||||
|
|
||||||
push-trt: build-trt
|
push-trt: build-trt
|
||||||
docker buildx build --push --platform linux/arm64 --tag $(IMAGE_REPO):${GITHUB_REF_NAME}-$(COMMIT_HASH)-tensorrt --file docker/build/rpi/Dockerfile .
|
docker buildx bake --push --file=docker/rpi/bake.hcl --set rpi.tags=$(IMAGE_REPO):${GITHUB_REF_NAME}-$(COMMIT_HASH)-tensorrt tensorrt
|
||||||
Loading…
Reference in New Issue
Block a user