mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-03 01:35:22 +03:00
Some more improvements
This commit is contained in:
parent
09cc368c4e
commit
35ab377694
@ -1,9 +1,14 @@
|
|||||||
{
|
{
|
||||||
"name": "Frigate Dev",
|
"name": "Frigate Devcontainer",
|
||||||
"dockerComposeFile": "../docker-compose.yml",
|
"dockerComposeFile": "../docker-compose.yml",
|
||||||
"service": "dev",
|
"service": "devcontainer",
|
||||||
"workspaceFolder": "/lab/frigate",
|
"workspaceFolder": "/workspace/frigate",
|
||||||
"initializeCommand": ".devcontainer/initialize.sh",
|
"initializeCommand": ".devcontainer/initialize.sh",
|
||||||
|
"overrideCommand": false,
|
||||||
|
"remoteUser": "vscode",
|
||||||
|
"features": {
|
||||||
|
"ghcr.io/devcontainers/features/common-utils:1": {}
|
||||||
|
},
|
||||||
"extensions": [
|
"extensions": [
|
||||||
"ms-python.vscode-pylance",
|
"ms-python.vscode-pylance",
|
||||||
"ms-python.python",
|
"ms-python.python",
|
||||||
@ -19,6 +24,7 @@
|
|||||||
"bradlc.vscode-tailwindcss"
|
"bradlc.vscode-tailwindcss"
|
||||||
],
|
],
|
||||||
"settings": {
|
"settings": {
|
||||||
|
"remote.autoForwardPorts": false,
|
||||||
"python.linting.pylintEnabled": true,
|
"python.linting.pylintEnabled": true,
|
||||||
"python.linting.enabled": true,
|
"python.linting.enabled": true,
|
||||||
"python.formatting.provider": "black",
|
"python.formatting.provider": "black",
|
||||||
|
|||||||
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@ -26,7 +26,5 @@ jobs:
|
|||||||
registry: ghcr.io
|
registry: ghcr.io
|
||||||
username: ${{ github.actor }}
|
username: ${{ github.actor }}
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
- name: Build web
|
|
||||||
run: make build_web
|
|
||||||
- name: Build image
|
- name: Build image
|
||||||
run: make push
|
run: make push
|
||||||
@ -1,3 +1,5 @@
|
|||||||
|
# # syntax=docker/dockerfile:1.2
|
||||||
|
|
||||||
FROM blakeblackshear/frigate-nginx:1.0.2 as nginx
|
FROM blakeblackshear/frigate-nginx:1.0.2 as nginx
|
||||||
|
|
||||||
FROM debian:11 as wheels
|
FROM debian:11 as wheels
|
||||||
@ -43,7 +45,7 @@ COPY requirements-wheels.txt /requirements-wheels.txt
|
|||||||
RUN pip3 wheel --wheel-dir=/wheels -r requirements-wheels.txt
|
RUN pip3 wheel --wheel-dir=/wheels -r requirements-wheels.txt
|
||||||
|
|
||||||
# Frigate without web
|
# Frigate without web
|
||||||
FROM debian:11-slim AS frigate-without-web
|
FROM debian:11-slim AS deps
|
||||||
ARG TARGETARCH
|
ARG TARGETARCH
|
||||||
|
|
||||||
# https://askubuntu.com/questions/972516/debian-frontend-environment-variable
|
# https://askubuntu.com/questions/972516/debian-frontend-environment-variable
|
||||||
@ -55,10 +57,9 @@ ENV NVIDIA_DRIVER_CAPABILITIES="compute,video,utility"
|
|||||||
|
|
||||||
ENV FLASK_ENV=development
|
ENV FLASK_ENV=development
|
||||||
|
|
||||||
COPY --from=wheels /wheels /wheels
|
|
||||||
|
|
||||||
# Install ffmpeg
|
# Install ffmpeg
|
||||||
RUN apt-get -qq update \
|
RUN --mount=type=bind,from=wheels,source=/wheels,target=/wheels \
|
||||||
|
apt-get -qq update \
|
||||||
&& apt-get -qq install --no-install-recommends -y \
|
&& apt-get -qq install --no-install-recommends -y \
|
||||||
apt-transport-https \
|
apt-transport-https \
|
||||||
gnupg \
|
gnupg \
|
||||||
@ -110,7 +111,6 @@ RUN apt-get -qq update \
|
|||||||
libtbb2 libtbb-dev libdc1394-22-dev libopenexr-dev \
|
libtbb2 libtbb-dev libdc1394-22-dev libopenexr-dev \
|
||||||
libgstreamer-plugins-base1.0-dev libgstreamer1.0-dev; \
|
libgstreamer-plugins-base1.0-dev libgstreamer1.0-dev; \
|
||||||
fi \
|
fi \
|
||||||
&& rm -rf /wheels \
|
|
||||||
&& apt-get remove gnupg apt-transport-https -y \
|
&& apt-get remove gnupg apt-transport-https -y \
|
||||||
&& apt-get clean autoclean -y \
|
&& apt-get clean autoclean -y \
|
||||||
&& apt-get autoremove -y \
|
&& apt-get autoremove -y \
|
||||||
@ -131,10 +131,6 @@ COPY labelmap.txt /labelmap.txt
|
|||||||
RUN wget -q https://github.com/google-coral/test_data/raw/release-frogfish/ssdlite_mobiledet_coco_qat_postprocess_edgetpu.tflite -O /edgetpu_model.tflite
|
RUN wget -q https://github.com/google-coral/test_data/raw/release-frogfish/ssdlite_mobiledet_coco_qat_postprocess_edgetpu.tflite -O /edgetpu_model.tflite
|
||||||
RUN wget -q https://github.com/google-coral/test_data/raw/release-frogfish/ssdlite_mobiledet_coco_qat_postprocess.tflite -O /cpu_model.tflite
|
RUN wget -q https://github.com/google-coral/test_data/raw/release-frogfish/ssdlite_mobiledet_coco_qat_postprocess.tflite -O /cpu_model.tflite
|
||||||
|
|
||||||
WORKDIR /opt/frigate/
|
|
||||||
ADD frigate frigate/
|
|
||||||
ADD migrations migrations/
|
|
||||||
|
|
||||||
COPY docker/rootfs/ /
|
COPY docker/rootfs/ /
|
||||||
|
|
||||||
# s6-overlay
|
# s6-overlay
|
||||||
@ -145,6 +141,41 @@ RUN S6_ARCH="${TARGETARCH}" \
|
|||||||
&& wget -O /tmp/s6-overlay-installer "https://github.com/just-containers/s6-overlay/releases/download/v2.2.0.3/s6-overlay-${S6_ARCH}-installer" \
|
&& wget -O /tmp/s6-overlay-installer "https://github.com/just-containers/s6-overlay/releases/download/v2.2.0.3/s6-overlay-${S6_ARCH}-installer" \
|
||||||
&& chmod +x /tmp/s6-overlay-installer && /tmp/s6-overlay-installer /
|
&& chmod +x /tmp/s6-overlay-installer && /tmp/s6-overlay-installer /
|
||||||
|
|
||||||
|
|
||||||
|
# Frigate with Node.js and NPM
|
||||||
|
FROM deps AS deps-node
|
||||||
|
|
||||||
|
# Install Node 16
|
||||||
|
RUN apt-get update -y \
|
||||||
|
&& apt-get install -y curl \
|
||||||
|
&& curl -sL https://deb.nodesource.com/setup_16.x | bash - \
|
||||||
|
&& apt-get install -y nodejs \
|
||||||
|
&& npm install -g npm@latest
|
||||||
|
|
||||||
|
# Build of the Frigate web
|
||||||
|
FROM deps-node AS web-build
|
||||||
|
|
||||||
|
WORKDIR /work
|
||||||
|
COPY web/package.json web/package-lock.json ./
|
||||||
|
RUN npm install
|
||||||
|
|
||||||
|
COPY web/ ./
|
||||||
|
RUN npm run build
|
||||||
|
|
||||||
|
# Web dist files
|
||||||
|
FROM scratch AS web-dist
|
||||||
|
|
||||||
|
COPY --from=web-build /work/dist/ /
|
||||||
|
|
||||||
|
|
||||||
|
# Frigate container
|
||||||
|
FROM deps
|
||||||
|
|
||||||
|
WORKDIR /opt/frigate/
|
||||||
|
COPY frigate frigate/
|
||||||
|
COPY migrations migrations/
|
||||||
|
COPY --from=web-dist / web/
|
||||||
|
|
||||||
EXPOSE 5000
|
EXPOSE 5000
|
||||||
EXPOSE 1935
|
EXPOSE 1935
|
||||||
EXPOSE 8554
|
EXPOSE 8554
|
||||||
@ -154,55 +185,12 @@ ENTRYPOINT ["/init"]
|
|||||||
|
|
||||||
CMD ["python3", "-u", "-m", "frigate"]
|
CMD ["python3", "-u", "-m", "frigate"]
|
||||||
|
|
||||||
|
|
||||||
# Frigate with Node.js and NPM
|
|
||||||
FROM frigate-without-web AS frigate-with-node
|
|
||||||
|
|
||||||
# Install Node 16
|
|
||||||
RUN apt-get update -y \
|
|
||||||
&& apt-get install -y curl \
|
|
||||||
&& curl -sL https://deb.nodesource.com/setup_16.x | bash - \
|
|
||||||
&& apt-get install -y nodejs
|
|
||||||
|
|
||||||
RUN npm install -g npm@latest
|
|
||||||
|
|
||||||
|
|
||||||
# Build of the Frigate web
|
|
||||||
FROM frigate-with-node AS web-build
|
|
||||||
|
|
||||||
WORKDIR /work
|
|
||||||
COPY web/package.json web/package-lock.json ./
|
|
||||||
RUN npm install
|
|
||||||
|
|
||||||
COPY web/ ./
|
|
||||||
RUN npm run build
|
|
||||||
|
|
||||||
|
|
||||||
# Frigate Container
|
|
||||||
FROM frigate-without-web
|
|
||||||
|
|
||||||
COPY --from=build-web /work/dist web/
|
|
||||||
|
|
||||||
|
|
||||||
# Devcontainer
|
# Devcontainer
|
||||||
FROM frigate-with-node AS dev
|
FROM deps-node AS devcontainer
|
||||||
|
|
||||||
ARG USERNAME=vscode
|
WORKDIR /workspace/frigate
|
||||||
ARG USER_UID=1000
|
|
||||||
ARG USER_GID=$USER_UID
|
|
||||||
|
|
||||||
# Create the user
|
RUN --mount=type=bind,source=./requirements-dev.txt,target=/workspace/frigate/requirements-dev.txt \
|
||||||
RUN groupadd --gid $USER_GID $USERNAME \
|
pip3 install -r requirements-dev.txt
|
||||||
&& useradd --uid $USER_UID --gid $USER_GID -m $USERNAME -s /bin/bash \
|
|
||||||
#
|
|
||||||
# [Optional] Add sudo support. Omit if you don't need to install software after connecting.
|
|
||||||
&& apt-get update \
|
|
||||||
&& apt-get install -y sudo \
|
|
||||||
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
|
|
||||||
&& chmod 0440 /etc/sudoers.d/$USERNAME
|
|
||||||
|
|
||||||
RUN apt-get update \
|
CMD ["sleep", "infinity"]
|
||||||
&& apt-get install -y git curl vim htop
|
|
||||||
|
|
||||||
COPY requirements-dev.txt /opt/frigate/requirements-dev.txt
|
|
||||||
RUN pip3 install -r requirements-dev.txt
|
|
||||||
16
Makefile
16
Makefile
@ -9,28 +9,28 @@ version:
|
|||||||
echo "VERSION=\"$(VERSION)-$(COMMIT_HASH)\"" > frigate/version.py
|
echo "VERSION=\"$(VERSION)-$(COMMIT_HASH)\"" > frigate/version.py
|
||||||
|
|
||||||
build_web:
|
build_web:
|
||||||
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"
|
docker buildx build --target web-dist --output web/dist .
|
||||||
|
|
||||||
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.nginx .
|
||||||
|
|
||||||
local:
|
local:
|
||||||
DOCKER_BUILDKIT=1 docker build --tag frigate:latest --file docker/Dockerfile .
|
docker buildx build --tag frigate:latest .
|
||||||
|
|
||||||
amd64:
|
amd64:
|
||||||
docker buildx build --platform linux/amd64 --tag blakeblackshear/frigate:$(VERSION)-$(COMMIT_HASH) --file docker/Dockerfile .
|
docker buildx build --platform linux/amd64 --tag blakeblackshear/frigate:$(VERSION)-$(COMMIT_HASH) .
|
||||||
|
|
||||||
arm64:
|
arm64:
|
||||||
docker buildx build --platform linux/arm64 --tag blakeblackshear/frigate:$(VERSION)-$(COMMIT_HASH) --file docker/Dockerfile .
|
docker buildx build --platform linux/arm64 --tag blakeblackshear/frigate:$(VERSION)-$(COMMIT_HASH) .
|
||||||
|
|
||||||
armv7:
|
armv7:
|
||||||
docker buildx build --platform linux/arm/v7 --tag blakeblackshear/frigate:$(VERSION)-$(COMMIT_HASH) --file docker/Dockerfile .
|
docker buildx build --platform linux/arm/v7 --tag blakeblackshear/frigate:$(VERSION)-$(COMMIT_HASH) .
|
||||||
|
|
||||||
build: version amd64 arm64 armv7
|
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) .
|
||||||
|
|
||||||
push: build
|
push: build
|
||||||
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 .
|
docker buildx build --push --platform linux/arm/v7,linux/arm64/v8,linux/amd64 --tag ghcr.io/blakeblackshear/frigate:${GITHUB_REF_NAME}-$(COMMIT_HASH) .
|
||||||
|
|
||||||
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
|
||||||
|
|||||||
@ -1,8 +1,7 @@
|
|||||||
version: "3"
|
version: "3"
|
||||||
services:
|
services:
|
||||||
dev:
|
devcontainer:
|
||||||
container_name: frigate-dev
|
container_name: frigate-devcontainer
|
||||||
user: vscode
|
|
||||||
# add groups from host for render, plugdev, video
|
# add groups from host for render, plugdev, video
|
||||||
group_add:
|
group_add:
|
||||||
- "109" # render
|
- "109" # render
|
||||||
@ -12,14 +11,13 @@ services:
|
|||||||
shm_size: "256mb"
|
shm_size: "256mb"
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: docker/Dockerfile
|
target: devcontainer
|
||||||
target: dev
|
|
||||||
devices:
|
devices:
|
||||||
- /dev/bus/usb:/dev/bus/usb
|
- /dev/bus/usb:/dev/bus/usb
|
||||||
# - /dev/dri:/dev/dri # for intel hwaccel, needs to be updated for your hardware
|
# - /dev/dri:/dev/dri # for intel hwaccel, needs to be updated for your hardware
|
||||||
volumes:
|
volumes:
|
||||||
|
- .:/workspace/frigate:cached
|
||||||
- /etc/localtime:/etc/localtime:ro
|
- /etc/localtime:/etc/localtime:ro
|
||||||
- .:/lab/frigate:cached
|
|
||||||
- ./config/config.yml:/config/config.yml:ro
|
- ./config/config.yml:/config/config.yml:ro
|
||||||
- ./debug:/media/frigate
|
- ./debug:/media/frigate
|
||||||
- /dev/bus/usb:/dev/bus/usb
|
- /dev/bus/usb:/dev/bus/usb
|
||||||
@ -30,8 +28,6 @@ services:
|
|||||||
- "5001:5001"
|
- "5001:5001"
|
||||||
- "8080:8080"
|
- "8080:8080"
|
||||||
- "8554:8554"
|
- "8554:8554"
|
||||||
entrypoint: ["sudo", "/init"]
|
|
||||||
command: /bin/sh -c "while sleep 1000; do :; done"
|
|
||||||
mqtt:
|
mqtt:
|
||||||
container_name: mqtt
|
container_name: mqtt
|
||||||
image: eclipse-mosquitto:1.6
|
image: eclipse-mosquitto:1.6
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user