mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-03 01:35:22 +03:00
Use hassio-addon as docker base image
This commit is contained in:
parent
c97aac6c94
commit
d28d6f6099
@ -43,7 +43,8 @@ COPY requirements-wheels.txt /requirements-wheels.txt
|
||||
RUN pip3 wheel --wheel-dir=/wheels -r requirements-wheels.txt
|
||||
|
||||
# Frigate Container
|
||||
FROM debian:11-slim
|
||||
# https://github.com/hassio-addons/addon-debian-base/releases
|
||||
FROM ghcr.io/hassio-addons/debian-base:6.1.3
|
||||
ARG TARGETARCH
|
||||
|
||||
# https://askubuntu.com/questions/972516/debian-frontend-environment-variable
|
||||
@ -55,6 +56,9 @@ ENV NVIDIA_DRIVER_CAPABILITIES="compute,video,utility"
|
||||
|
||||
ENV FLASK_ENV=development
|
||||
|
||||
# https://github.com/home-assistant/core/issues/79976
|
||||
ENV S6_SERVICES_READYTIME=50
|
||||
|
||||
COPY --from=wheels /wheels /wheels
|
||||
|
||||
# Install ffmpeg
|
||||
@ -116,7 +120,7 @@ RUN apt-get -qq update \
|
||||
&& apt-get autoremove -y \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
ENV PATH=$PATH:/usr/lib/btbn-ffmpeg/bin
|
||||
ENV PATH="/usr/lib/btbn-ffmpeg/bin:$PATH"
|
||||
|
||||
# install go2rtc
|
||||
RUN wget -O go2rtc "https://github.com/AlexxIT/go2rtc/releases/download/v0.1-rc.2/go2rtc_linux_${TARGETARCH}" \
|
||||
@ -124,8 +128,12 @@ RUN wget -O go2rtc "https://github.com/AlexxIT/go2rtc/releases/download/v0.1-rc.
|
||||
&& mkdir -p /usr/local/go2rtc/sbin/ \
|
||||
&& mv go2rtc /usr/local/go2rtc/sbin/go2rtc
|
||||
|
||||
ENV PATH="/usr/local/go2rtc/sbin:$PATH"
|
||||
|
||||
COPY --from=nginx /usr/local/nginx/ /usr/local/nginx/
|
||||
|
||||
ENV PATH="/usr/local/nginx/sbin:$PATH"
|
||||
|
||||
# get model and labels
|
||||
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
|
||||
@ -139,19 +147,7 @@ COPY web/dist web/
|
||||
|
||||
COPY docker/rootfs/ /
|
||||
|
||||
# s6-overlay
|
||||
RUN S6_ARCH="${TARGETARCH}" \
|
||||
&& if [ "${TARGETARCH}" = "amd64" ]; then S6_ARCH="amd64"; fi \
|
||||
&& if [ "${TARGETARCH}" = "arm" ]; then S6_ARCH="armhf"; fi \
|
||||
&& if [ "${TARGETARCH}" = "arm64" ]; then S6_ARCH="aarch64"; fi \
|
||||
&& 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 /
|
||||
|
||||
EXPOSE 5000
|
||||
EXPOSE 1935
|
||||
EXPOSE 8554
|
||||
EXPOSE 8555
|
||||
|
||||
ENTRYPOINT ["/init"]
|
||||
|
||||
CMD ["python3", "-u", "-m", "frigate"]
|
||||
|
||||
12
docker/rootfs/etc/services.d/frigate/finish
Executable file
12
docker/rootfs/etc/services.d/frigate/finish
Executable file
@ -0,0 +1,12 @@
|
||||
#!/command/with-contenv bashio
|
||||
# ==============================================================================
|
||||
# Take down the S6 supervision tree when Frigate fails
|
||||
# ==============================================================================
|
||||
# shellcheck shell=bash
|
||||
|
||||
if [[ "${1}" -ne 0 ]] && [[ "${1}" -ne 256 ]]; then
|
||||
bashio::log.warning "Frigate crashed, halting container..."
|
||||
/run/s6/basedir/bin/halt
|
||||
fi
|
||||
|
||||
bashio::log.info "Frigate stopped, restarting..."
|
||||
9
docker/rootfs/etc/services.d/frigate/run
Executable file
9
docker/rootfs/etc/services.d/frigate/run
Executable file
@ -0,0 +1,9 @@
|
||||
#!/command/with-contenv bashio
|
||||
# ==============================================================================
|
||||
# Runs Frigate
|
||||
# ==============================================================================
|
||||
# shellcheck shell=bash
|
||||
|
||||
bashio::log.info 'Starting Frigate...'
|
||||
|
||||
exec python3 -u -m frigate
|
||||
15
docker/rootfs/etc/services.d/go2rtc/finish
Normal file → Executable file
15
docker/rootfs/etc/services.d/go2rtc/finish
Normal file → Executable file
@ -1,5 +1,12 @@
|
||||
#!/usr/bin/execlineb -S1
|
||||
if { s6-test ${1} -ne 0 }
|
||||
if { s6-test ${1} -ne 256 }
|
||||
#!/command/with-contenv bashio
|
||||
# ==============================================================================
|
||||
# Take down the S6 supervision tree when go2rtc fails
|
||||
# ==============================================================================
|
||||
# shellcheck shell=bash
|
||||
|
||||
s6-svscanctl -t /var/run/s6/services
|
||||
if [[ "${1}" -ne 0 ]] && [[ "${1}" -ne 256 ]]; then
|
||||
bashio::log.warning "go2rtc crashed, halting container..."
|
||||
/run/s6/basedir/bin/halt
|
||||
fi
|
||||
|
||||
bashio::log.info "go2rtc stopped, restarting..."
|
||||
|
||||
17
docker/rootfs/etc/services.d/go2rtc/run
Normal file → Executable file
17
docker/rootfs/etc/services.d/go2rtc/run
Normal file → Executable file
@ -1,12 +1,17 @@
|
||||
#!/bin/bash
|
||||
#!/command/with-contenv bashio
|
||||
# ==============================================================================
|
||||
# Runs go2rtc
|
||||
# ==============================================================================
|
||||
# shellcheck shell=bash
|
||||
|
||||
# https://gist.github.com/mohanpedala/1e2ff5661761d3abd0385e8223e16425?permalink_comment_id=3945021
|
||||
set -euo pipefail
|
||||
bashio::log.info 'Starting go2rtc...'
|
||||
|
||||
declare config_path
|
||||
|
||||
if [[ -f "/config/frigate-go2rtc.yaml" ]]; then
|
||||
CONFIG_PATH=/config/frigate-go2rtc.yaml
|
||||
config_path="/config/frigate-go2rtc.yaml"
|
||||
else
|
||||
CONFIG_PATH=/usr/local/go2rtc/sbin/go2rtc.yaml
|
||||
config_path="/usr/local/go2rtc/sbin/go2rtc.yaml"
|
||||
fi
|
||||
|
||||
exec /usr/local/go2rtc/sbin/go2rtc -config="$CONFIG_PATH"
|
||||
exec go2rtc -config="$config_path"
|
||||
|
||||
15
docker/rootfs/etc/services.d/nginx/finish
Normal file → Executable file
15
docker/rootfs/etc/services.d/nginx/finish
Normal file → Executable file
@ -1,5 +1,12 @@
|
||||
#!/usr/bin/execlineb -S1
|
||||
if { s6-test ${1} -ne 0 }
|
||||
if { s6-test ${1} -ne 256 }
|
||||
#!/command/with-contenv bashio
|
||||
# ==============================================================================
|
||||
# Take down the S6 supervision tree when NGINX fails
|
||||
# ==============================================================================
|
||||
# shellcheck shell=bash
|
||||
|
||||
s6-svscanctl -t /var/run/s6/services
|
||||
if [[ "${1}" -ne 0 ]] && [[ "${1}" -ne 256 ]]; then
|
||||
bashio::log.warning "NGINX crashed, halting container..."
|
||||
/run/s6/basedir/bin/halt
|
||||
fi
|
||||
|
||||
bashio::log.info "NGINX stopped, restarting..."
|
||||
|
||||
11
docker/rootfs/etc/services.d/nginx/run
Normal file → Executable file
11
docker/rootfs/etc/services.d/nginx/run
Normal file → Executable file
@ -1,2 +1,9 @@
|
||||
#!/usr/bin/execlineb -P
|
||||
/usr/local/nginx/sbin/nginx
|
||||
#!/command/with-contenv bashio
|
||||
# ==============================================================================
|
||||
# Runs NGINX
|
||||
# ==============================================================================
|
||||
# shellcheck shell=bash
|
||||
|
||||
bashio::log.info 'Starting NGINX...'
|
||||
|
||||
exec nginx -g "daemon off;"
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
daemon off;
|
||||
user root;
|
||||
worker_processes 1;
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user