added healthcheck and made it copy the original nginx.conf as default to the correct dir
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user