From 07def5ba04164224f8c45ceead4c23255074f2f0 Mon Sep 17 00:00:00 2001 From: Alexey Khit Date: Sun, 21 Aug 2022 09:27:02 +0300 Subject: [PATCH] Adds restarts support to docker container --- build/hassio/Dockerfile | 5 ++++- build/hassio/run.sh | 13 +++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 build/hassio/run.sh diff --git a/build/hassio/Dockerfile b/build/hassio/Dockerfile index fc12eb2c..4a1eac59 100644 --- a/build/hassio/Dockerfile +++ b/build/hassio/Dockerfile @@ -16,4 +16,7 @@ RUN if [ "${BUILD_ARCH}" = "aarch64" ]; then BUILD_ARCH="arm64"; \ && curl $(curl -s "https://raw.githubusercontent.com/ngrok/docker-ngrok/main/releases.json" | jq -r ".${BUILD_ARCH}.url") -o ngrok.zip \ && unzip ngrok -CMD [ "/app/go2rtc", "-config", "/config/go2rtc.yaml" ] +COPY run.sh / +RUN chmod a+x /run.sh + +CMD [ "/run.sh" ] diff --git a/build/hassio/run.sh b/build/hassio/run.sh new file mode 100644 index 00000000..ddf7ab58 --- /dev/null +++ b/build/hassio/run.sh @@ -0,0 +1,13 @@ +#!/usr/bin/with-contenv bashio + +set +e + +while true; do + if [ -x /config/go2rtc ]; then + /config/go2rtc -config /config/go2rtc.yaml + else + /app/go2rtc -config /config/go2rtc.yaml + fi + + sleep 5 +done \ No newline at end of file