From 7c58c3ed4e843e4dd0bdf477dceea2a588b4fe8a Mon Sep 17 00:00:00 2001 From: Indrek Mandre Date: Sun, 4 Feb 2024 13:13:18 +0200 Subject: [PATCH] docker/main: add download-models overlay into s6 startup --- docker/main/Dockerfile | 2 ++ .../s6-rc.d/download-models/dependencies.d/base | 0 .../rootfs/etc/s6-overlay/s6-rc.d/download-models/run | 8 ++++++++ .../etc/s6-overlay/s6-rc.d/download-models/timeout-up | 1 + .../rootfs/etc/s6-overlay/s6-rc.d/download-models/type | 1 + .../main/rootfs/etc/s6-overlay/s6-rc.d/download-models/up | 1 + .../s6-rc.d/frigate/dependencies.d/download-models | 0 7 files changed, 13 insertions(+) create mode 100644 docker/main/rootfs/etc/s6-overlay/s6-rc.d/download-models/dependencies.d/base create mode 100755 docker/main/rootfs/etc/s6-overlay/s6-rc.d/download-models/run create mode 100644 docker/main/rootfs/etc/s6-overlay/s6-rc.d/download-models/timeout-up create mode 100644 docker/main/rootfs/etc/s6-overlay/s6-rc.d/download-models/type create mode 100644 docker/main/rootfs/etc/s6-overlay/s6-rc.d/download-models/up create mode 100644 docker/main/rootfs/etc/s6-overlay/s6-rc.d/frigate/dependencies.d/download-models diff --git a/docker/main/Dockerfile b/docker/main/Dockerfile index e35eac191..a4dd1921a 100644 --- a/docker/main/Dockerfile +++ b/docker/main/Dockerfile @@ -197,6 +197,8 @@ EXPOSE 8555/tcp 8555/udp # Configure logging to prepend timestamps, log to stdout, keep 0 archives and rotate on 10MB ENV S6_LOGGING_SCRIPT="T 1 n0 s10000000 T" +# Do not fail on long-running download scripts +ENV S6_CMD_WAIT_FOR_SERVICES_MAXTIME=0 ENTRYPOINT ["/init"] CMD [] diff --git a/docker/main/rootfs/etc/s6-overlay/s6-rc.d/download-models/dependencies.d/base b/docker/main/rootfs/etc/s6-overlay/s6-rc.d/download-models/dependencies.d/base new file mode 100644 index 000000000..e69de29bb diff --git a/docker/main/rootfs/etc/s6-overlay/s6-rc.d/download-models/run b/docker/main/rootfs/etc/s6-overlay/s6-rc.d/download-models/run new file mode 100755 index 000000000..4a7abe814 --- /dev/null +++ b/docker/main/rootfs/etc/s6-overlay/s6-rc.d/download-models/run @@ -0,0 +1,8 @@ +#!/command/with-contenv bash +# shellcheck shell=bash +# Download yolov8 models when DOWNLOAD_YOLOV8=1 environment variable is set + +set -o errexit -o nounset -o pipefail + +python3 /opt/frigate/frigate/util/download_models.py + diff --git a/docker/main/rootfs/etc/s6-overlay/s6-rc.d/download-models/timeout-up b/docker/main/rootfs/etc/s6-overlay/s6-rc.d/download-models/timeout-up new file mode 100644 index 000000000..573541ac9 --- /dev/null +++ b/docker/main/rootfs/etc/s6-overlay/s6-rc.d/download-models/timeout-up @@ -0,0 +1 @@ +0 diff --git a/docker/main/rootfs/etc/s6-overlay/s6-rc.d/download-models/type b/docker/main/rootfs/etc/s6-overlay/s6-rc.d/download-models/type new file mode 100644 index 000000000..bdd22a185 --- /dev/null +++ b/docker/main/rootfs/etc/s6-overlay/s6-rc.d/download-models/type @@ -0,0 +1 @@ +oneshot diff --git a/docker/main/rootfs/etc/s6-overlay/s6-rc.d/download-models/up b/docker/main/rootfs/etc/s6-overlay/s6-rc.d/download-models/up new file mode 100644 index 000000000..8daf1e9de --- /dev/null +++ b/docker/main/rootfs/etc/s6-overlay/s6-rc.d/download-models/up @@ -0,0 +1 @@ +/etc/s6-overlay/s6-rc.d/download-models/run diff --git a/docker/main/rootfs/etc/s6-overlay/s6-rc.d/frigate/dependencies.d/download-models b/docker/main/rootfs/etc/s6-overlay/s6-rc.d/frigate/dependencies.d/download-models new file mode 100644 index 000000000..e69de29bb