From ef362c461825b929541795d92cd67bfb9b6e321e Mon Sep 17 00:00:00 2001 From: TheSpad Date: Tue, 6 Jun 2023 14:41:25 +0100 Subject: [PATCH] Allow readiness check to use custom ports --- Dockerfile | 3 ++- Dockerfile.aarch64 | 3 ++- root/etc/s6-overlay/s6-rc.d/svc-sonarr/data/check | 4 +++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 05922d4..c33ba87 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,7 +17,8 @@ RUN \ echo "**** install packages ****" && \ apk add --no-cache \ icu-libs \ - sqlite-libs && \ + sqlite-libs \ + xmlstarlet && \ echo "**** install sonarr ****" && \ mkdir -p /app/sonarr/bin && \ if [ -z ${SONARR_VERSION+x} ]; then \ diff --git a/Dockerfile.aarch64 b/Dockerfile.aarch64 index 9fd2786..4ef0e5c 100644 --- a/Dockerfile.aarch64 +++ b/Dockerfile.aarch64 @@ -17,7 +17,8 @@ RUN \ echo "**** install packages ****" && \ apk add --no-cache \ icu-libs \ - sqlite-libs && \ + sqlite-libs \ + xmlstarlet && \ echo "**** install sonarr ****" && \ mkdir -p /app/sonarr/bin && \ if [ -z ${SONARR_VERSION+x} ]; then \ diff --git a/root/etc/s6-overlay/s6-rc.d/svc-sonarr/data/check b/root/etc/s6-overlay/s6-rc.d/svc-sonarr/data/check index b752f1e..ad7e6e9 100755 --- a/root/etc/s6-overlay/s6-rc.d/svc-sonarr/data/check +++ b/root/etc/s6-overlay/s6-rc.d/svc-sonarr/data/check @@ -1,6 +1,8 @@ #!/bin/bash -if [[ $(curl -sL "http://localhost:8989/ping" | jq -r '.status' 2>/dev/null) = "OK" ]]; then +PORT=$(xmlstarlet sel -T -t -v /Config/Port /config/config.xml) + +if [[ $(curl -sL "http://localhost:${PORT:-8989}/ping" | jq -r '.status' 2>/dev/null) = "OK" ]]; then exit 0 else exit 1