From ff4375cf6ce849459889f892dd91304703c52dcd Mon Sep 17 00:00:00 2001 From: Andrew Kennedy Date: Sat, 22 Jul 2023 14:07:15 -0700 Subject: [PATCH] feat: add a healthcheck script that works with a dynamic port (#2510) --- Dockerfile | 8 ++++++-- healthcheck.sh | 3 +++ 2 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 healthcheck.sh diff --git a/Dockerfile b/Dockerfile index ab826705..40a91a06 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,14 @@ FROM alpine:latest RUN apk --update add ca-certificates \ mailcap \ - curl + curl \ + jq + +COPY healthcheck.sh /healthcheck.sh +RUN chmod +x /healthcheck.sh # Make the script executable HEALTHCHECK --start-period=2s --interval=5s --timeout=3s \ - CMD curl -f http://localhost/health || exit 1 + CMD /healthcheck.sh || exit 1 VOLUME /srv EXPOSE 80 diff --git a/healthcheck.sh b/healthcheck.sh new file mode 100644 index 00000000..43eb2176 --- /dev/null +++ b/healthcheck.sh @@ -0,0 +1,3 @@ +#!/bin/sh +PORT=$(jq .port /.filebrowser.json) +curl -f http://localhost:$PORT/health || exit 1