containers-nginx/Dockerfile

46 lines
1.2 KiB
Text
Raw Normal View History

2021-10-03 23:19:00 +00:00
ARG ALPINE_VERSION=3.13.6
ARG BASE_IMAGE=sutty/monit
FROM ${BASE_IMAGE}:${ALPINE_VERSION}
2019-09-10 23:10:18 +00:00
MAINTAINER "f <f@sutty.nl>"
2022-03-04 03:25:40 +00:00
ARG GEOIP2_DATABASE
ARG CRAWLERS
ARG ACCESS_LOGS_FLAGS="--database=sqlite3:///root/development.sqlite3"
ENV ACCESS_LOGS_FLAGS=${ACCESS_LOGS_FLAGS}
# Install nginx and remove default config
RUN apk add --no-cache nginx daemonize access_log nginx-prometheus-exporter \
&& rm -rf /etc/nginx
# Add ssl group so nginx has access to certificates
RUN addgroup -S -g 777 ssl
RUN addgroup nginx ssl
# Databases
RUN wget "${CRAWLERS}" -O /tmp/crawler-user-agents.json
RUN wget ${GEOIP2_DATABASE} -O - | tar -xJf - \
&& rm usr/share/GeoIP/GeoLite2-ASN.mmdb .BUILDINFO .MTREE .PKGINFO
COPY ./monit.conf /etc/monit.d/nginx.conf
COPY ./prometheusd.sh /usr/local/bin/prometheusd
COPY ./nginx /etc/nginx
# Install modules after rewriting /etc/nginx
RUN apk add --no-cache nginx-mod-http-brotli nginx-mod-http-geoip2
# 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 chown -R nginx:nginx /etc/nginx
RUN nginx -t
# Shared configuration
VOLUME /etc/nginx/sites
VOLUME /etc/letsencrypt
VOLUME /var/lib/letsencrypt
EXPOSE 80
EXPOSE 443
EXPOSE 443/udp
EXPOSE 9113