2023-08-24 14:50:53 +00:00
|
|
|
ARG ALPINE_VERSION=3.18.3
|
|
|
|
ARG BASE_IMAGE=gitea.nulo.in/sutty/monit
|
2021-10-03 23:19:00 +00:00
|
|
|
FROM ${BASE_IMAGE}:${ALPINE_VERSION}
|
2024-06-21 15:21:51 +00:00
|
|
|
LABEL org.opencontainers.image.authors="f@sutty.nl"
|
2022-03-04 03:25:40 +00:00
|
|
|
|
2023-10-17 14:16:37 +00:00
|
|
|
ARG NGINX_VERSION="1.24.0-r7"
|
2023-01-21 23:14:57 +00:00
|
|
|
ARG ACCESS_LOGS_FLAGS="--database=sqlite3:///var/log/access_log.sqlite3 -c /usr/share/crawler-user-agents/crawler-user-agents.json"
|
2024-02-13 16:28:30 +00:00
|
|
|
ARG ACCESS_LOG_VERSION="0.5.6"
|
2024-11-05 14:21:04 +00:00
|
|
|
ARG EXTRA_PACKAGES
|
2022-03-04 03:25:40 +00:00
|
|
|
|
|
|
|
ENV ACCESS_LOGS_FLAGS=${ACCESS_LOGS_FLAGS}
|
|
|
|
|
|
|
|
# Install nginx and remove default config
|
2023-10-17 14:16:37 +00:00
|
|
|
RUN apk add --no-cache nginx~${NGINX_VERSION} daemonize access_log~${ACCESS_LOG_VERSION} nginx-prometheus-exporter geoip2-database-country geoip2-database-city crawler-user-agents \
|
2022-03-04 03:25:40 +00:00
|
|
|
&& rm -rf /etc/nginx
|
|
|
|
|
|
|
|
# Add ssl group so nginx has access to certificates
|
|
|
|
RUN addgroup -S -g 777 ssl
|
|
|
|
RUN addgroup nginx ssl
|
|
|
|
|
|
|
|
COPY ./monit.conf /etc/monit.d/nginx.conf
|
|
|
|
COPY ./prometheusd.sh /usr/local/bin/prometheusd
|
2023-01-21 23:14:57 +00:00
|
|
|
COPY ./access_logd.sh /usr/bin/access_logd
|
2023-10-17 14:15:24 +00:00
|
|
|
COPY --chown=nginx:nginx ./nginx /etc/nginx
|
2023-01-21 23:14:57 +00:00
|
|
|
COPY ./access_log.sqlite3 /var/lib/access_log.sqlite3
|
2022-03-04 03:25:40 +00:00
|
|
|
|
|
|
|
# Install modules after rewriting /etc/nginx
|
2024-11-05 14:21:04 +00:00
|
|
|
RUN apk add --no-cache nginx-mod-http-brotli nginx-mod-http-geoip2 ${EXTRA_PACKAGES}
|
2022-03-04 03:25:40 +00:00
|
|
|
|
|
|
|
# Add support for request_uri parsing if access_log >= 0.3.0
|
|
|
|
RUN mv /etc/nginx/access_logd_`access_log -v`.conf /etc/nginx/access_logd.conf
|
|
|
|
RUN nginx -t
|
|
|
|
|
2023-04-20 16:04:54 +00:00
|
|
|
RUN chown nginx:nginx /var/lib/access_log.sqlite3
|
2023-01-21 23:14:57 +00:00
|
|
|
|
2022-03-04 03:25:40 +00:00
|
|
|
# Shared configuration
|
|
|
|
VOLUME /etc/nginx/sites
|
|
|
|
VOLUME /etc/letsencrypt
|
|
|
|
VOLUME /var/lib/letsencrypt
|
|
|
|
|
|
|
|
EXPOSE 80
|
|
|
|
EXPOSE 443
|
|
|
|
EXPOSE 9113
|