From f4138fd73341b3f2f884d8685b029b0402768cc5 Mon Sep 17 00:00:00 2001 From: Frederik Ring Date: Fri, 4 Aug 2023 13:49:58 +0200 Subject: [PATCH] Run httpd server in container if requested --- Dockerfile | 2 +- entrypoint.sh | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 42249c4..a0963de 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,7 +13,7 @@ FROM alpine:3.18 WORKDIR /root -RUN apk add --no-cache ca-certificates +RUN apk add --no-cache ca-certificates busybox-extras COPY --from=builder /app/cmd/backup/backup /usr/bin/backup COPY --chmod=755 ./entrypoint.sh /root/ diff --git a/entrypoint.sh b/entrypoint.sh index edbf6c9..2ecd7a1 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -22,5 +22,12 @@ else done fi +if [ ! -z "$SERVE_METRICS_PATH" ]; then + mkdir -p /var/www/html${SERVE_METRICS_PATH} + echo "ok" > /var/www/html${SERVE_METRICS_PATH}/metrics.txt + httpd -h /var/www/html -p "${SERVE_METRICS_PORT:-80}" + echo "Serving metrics on port ${SERVE_METRICS_PORT:-80}." +fi + echo "Starting cron in foreground." crond -f -d 8