From a9c4b1fdf4be850e31ebe831f514f9d0fbd81f87 Mon Sep 17 00:00:00 2001 From: Zoey Date: Thu, 25 Aug 2022 16:57:59 +0200 Subject: [PATCH] fix apache healthcheck Signed-off-by: Zoey Co-Authored-By: Simon L. --- Containers/apache/Dockerfile | 4 +++- Containers/apache/healthcheck.sh | 8 ++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 Containers/apache/healthcheck.sh diff --git a/Containers/apache/Dockerfile b/Containers/apache/Dockerfile index 42db9cb5..22576972 100644 --- a/Containers/apache/Dockerfile +++ b/Containers/apache/Dockerfile @@ -61,8 +61,10 @@ RUN mkdir /var/log/supervisord; \ COPY Caddyfile / COPY start.sh /usr/bin/ +COPY healthcheck.sh /usr/bin/ COPY supervisord.conf / RUN chmod +x /usr/bin/start.sh; \ + chmod +x /usr/bin/healthcheck.sh; \ chmod +r /supervisord.conf; \ chown www-data:www-data /Caddyfile; \ chmod +r -R /etc/apache2 @@ -75,4 +77,4 @@ USER www-data ENTRYPOINT ["start.sh"] CMD ["/usr/bin/supervisord", "-c", "/supervisord.conf"] -HEALTHCHECK CMD (curl -skfI localhost:8000 && curl -skfI localhost:$APACHE_PORT) || exit 1 \ No newline at end of file +HEALTHCHECK CMD healthcheck.sh \ No newline at end of file diff --git a/Containers/apache/healthcheck.sh b/Containers/apache/healthcheck.sh new file mode 100644 index 00000000..b11d8b5b --- /dev/null +++ b/Containers/apache/healthcheck.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +curl -skfI localhost:8000 || exit 1 +if [ "$APACHE_PORT" != '443' ]; then + curl -skfI localhost:"$APACHE_PORT" || exit 1 +else + curl -skfI https://"$NC_DOMAIN":"$APACHE_PORT" || exit 1 +fi