mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-03 01:35:22 +03:00
Make it easier to run the devcontainer
This commit is contained in:
parent
ed1897db71
commit
4165a1d82c
@ -3,14 +3,15 @@
|
|||||||
"dockerComposeFile": "../docker-compose.yml",
|
"dockerComposeFile": "../docker-compose.yml",
|
||||||
"service": "dev",
|
"service": "dev",
|
||||||
"workspaceFolder": "/lab/frigate",
|
"workspaceFolder": "/lab/frigate",
|
||||||
|
"initializeCommand": ".devcontainer/initialize.sh",
|
||||||
"extensions": [
|
"extensions": [
|
||||||
|
"ms-python.vscode-pylance",
|
||||||
"ms-python.python",
|
"ms-python.python",
|
||||||
"visualstudioexptteam.vscodeintellicode",
|
"visualstudioexptteam.vscodeintellicode",
|
||||||
"mhutchie.git-graph",
|
"mhutchie.git-graph",
|
||||||
"ms-azuretools.vscode-docker",
|
"ms-azuretools.vscode-docker",
|
||||||
"streetsidesoftware.code-spell-checker",
|
"streetsidesoftware.code-spell-checker",
|
||||||
"esbenp.prettier-vscode",
|
"esbenp.prettier-vscode",
|
||||||
"ms-python.vscode-pylance",
|
|
||||||
"dbaeumer.vscode-eslint",
|
"dbaeumer.vscode-eslint",
|
||||||
"mikestead.dotenv",
|
"mikestead.dotenv",
|
||||||
"csstools.postcss",
|
"csstools.postcss",
|
||||||
|
|||||||
10
.devcontainer/initialize.sh
Executable file
10
.devcontainer/initialize.sh
Executable file
@ -0,0 +1,10 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
if [[ -f "config/config.yml" ]]; then
|
||||||
|
echo "config/config.yml already exists, skipping initialization" >&2
|
||||||
|
else
|
||||||
|
echo "initializing config/config.yml" >&2
|
||||||
|
cp -fv config/config.yml.example config/config.yml
|
||||||
|
fi
|
||||||
2
Makefile
2
Makefile
@ -15,7 +15,7 @@ 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 .
|
||||||
|
|
||||||
local:
|
local:
|
||||||
DOCKER_BUILDKIT=1 docker build -t frigate -f docker/Dockerfile .
|
DOCKER_BUILDKIT=1 docker build --tag frigate:latest --file docker/Dockerfile .
|
||||||
|
|
||||||
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) --file docker/Dockerfile .
|
||||||
|
|||||||
16
config/config.yml.example
Normal file
16
config/config.yml.example
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
mqtt:
|
||||||
|
host: mqtt
|
||||||
|
|
||||||
|
cameras:
|
||||||
|
test:
|
||||||
|
ffmpeg:
|
||||||
|
inputs:
|
||||||
|
- path: /media/frigate/car-stopping.mp4
|
||||||
|
input_args: -re -stream_loop -1 -fflags +genpts
|
||||||
|
roles:
|
||||||
|
- detect
|
||||||
|
- rtmp
|
||||||
|
detect:
|
||||||
|
height: 1080
|
||||||
|
width: 1920
|
||||||
|
fps: 5
|
||||||
@ -12,10 +12,11 @@ services:
|
|||||||
shm_size: "256mb"
|
shm_size: "256mb"
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: docker/Dockerfile.dev
|
dockerfile: docker/Dockerfile
|
||||||
|
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:
|
||||||
- /etc/localtime:/etc/localtime:ro
|
- /etc/localtime:/etc/localtime:ro
|
||||||
- .:/lab/frigate:cached
|
- .:/lab/frigate:cached
|
||||||
|
|||||||
@ -42,8 +42,8 @@ RUN pip3 install -r requirements.txt
|
|||||||
COPY requirements-wheels.txt /requirements-wheels.txt
|
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 Container
|
# Frigate without web
|
||||||
FROM debian:11-slim
|
FROM debian:11-slim AS frigate-without-web
|
||||||
ARG TARGETARCH
|
ARG TARGETARCH
|
||||||
|
|
||||||
ARG JELLYFIN_FFMPEG_VERSION=5.0.1-7
|
ARG JELLYFIN_FFMPEG_VERSION=5.0.1-7
|
||||||
@ -118,8 +118,6 @@ WORKDIR /opt/frigate/
|
|||||||
ADD frigate frigate/
|
ADD frigate frigate/
|
||||||
ADD migrations migrations/
|
ADD migrations migrations/
|
||||||
|
|
||||||
COPY web/dist web/
|
|
||||||
|
|
||||||
COPY docker/rootfs/ /
|
COPY docker/rootfs/ /
|
||||||
|
|
||||||
# s6-overlay
|
# s6-overlay
|
||||||
@ -136,3 +134,56 @@ EXPOSE 1935
|
|||||||
ENTRYPOINT ["/init"]
|
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
|
||||||
|
FROM frigate-with-node AS dev
|
||||||
|
|
||||||
|
ARG USERNAME=vscode
|
||||||
|
ARG USER_UID=1000
|
||||||
|
ARG USER_GID=$USER_UID
|
||||||
|
|
||||||
|
# Create the user
|
||||||
|
RUN groupadd --gid $USER_GID $USERNAME \
|
||||||
|
&& 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 \
|
||||||
|
&& apt-get install -y git curl vim htop
|
||||||
|
|
||||||
|
COPY requirements-dev.txt /opt/frigate/requirements-dev.txt
|
||||||
|
RUN pip3 install -r requirements-dev.txt
|
||||||
|
|||||||
@ -1,27 +0,0 @@
|
|||||||
FROM frigate:latest
|
|
||||||
|
|
||||||
ARG USERNAME=vscode
|
|
||||||
ARG USER_UID=1000
|
|
||||||
ARG USER_GID=$USER_UID
|
|
||||||
|
|
||||||
# Create the user
|
|
||||||
RUN groupadd --gid $USER_GID $USERNAME \
|
|
||||||
&& 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 \
|
|
||||||
&& apt-get install -y git curl vim htop
|
|
||||||
|
|
||||||
COPY requirements-dev.txt /opt/frigate/requirements-dev.txt
|
|
||||||
RUN pip3 install -r requirements-dev.txt
|
|
||||||
|
|
||||||
# Install Node 16
|
|
||||||
RUN curl -sL https://deb.nodesource.com/setup_16.x | bash - \
|
|
||||||
&& apt-get install -y nodejs
|
|
||||||
|
|
||||||
RUN npm install -g npm@latest
|
|
||||||
3
web/.dockerignore
Normal file
3
web/.dockerignore
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
.git/
|
||||||
|
dist/
|
||||||
|
node_modules/
|
||||||
Loading…
Reference in New Issue
Block a user