From 4fe8c194ee2bbd6d5652613b2842ee38b4e7bace Mon Sep 17 00:00:00 2001 From: db1234719 Date: Thu, 13 Nov 2025 16:50:02 +0000 Subject: [PATCH] added healthcheck and made it copy the original nginx.conf as default to the correct dir --- DockerfileTest | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/DockerfileTest b/DockerfileTest index 33e2843..fd7c402 100644 --- a/DockerfileTest +++ b/DockerfileTest @@ -27,7 +27,7 @@ RUN curl -fSL https://nginx.org/download/nginx-$NGINX_VERSION.tar.gz -o nginx.ta # --- Stage 2: runtime --- FROM alpine:3.22 -RUN apk add --no-cache pcre2 zlib openssl ca-certificates \ +RUN apk add --no-cache pcre2 zlib openssl ca-certificates wget \ && adduser -D -g 'nginx' nginx \ && mkdir -p /var/cache/nginx /etc/nginx/conf.d /usr/share/nginx/html \ && chown -R nginx:nginx /var/cache/nginx /var/run /etc/nginx /usr/share/nginx/html @@ -35,7 +35,10 @@ RUN apk add --no-cache pcre2 zlib openssl ca-certificates \ COPY --from=builder /usr/sbin/nginx /usr/sbin/nginx COPY --from=builder /etc/nginx /etc/nginx COPY --from=builder /usr/lib/nginx /usr/lib/nginx +COPY nginx.conf /etc/nginx/nginx.conf -EXPOSE 80 +EXPOSE 80 443 STOPSIGNAL SIGTERM CMD ["nginx", "-g", "daemon off;"] + +HEALTHCHECK --interval=30s --timeout=3s --retries=3 CMD wget -qO- http://127.0.0.1:80/ || exit 1