FROM library/nginx:1.31.2-alpine

ENV NGINX_LOG_DIR=/var/log/nginx
# this is to avoid having these logs redirected to stdout/stderr
RUN rm $NGINX_LOG_DIR/access.log $NGINX_LOG_DIR/error.log && touch $NGINX_LOG_DIR/access.log $NGINX_LOG_DIR/error.log
VOLUME /var/log/nginx

HEALTHCHECK --interval=3s --start-period=2s --timeout=2s --retries=5 CMD curl --fail http://localhost/hc || exit 1