nginx/Dockerfile
2023-02-03 16:17:49 +11:00

33 lines
1.2 KiB
Docker

# NAME leenooks/nginx
# VERSION latest
FROM nginx:alpine
# Change to http respositories, so they we can cache the install packages
RUN if [ -n ${HTTP_PROXY} ] ; then sed -ie s'/https/http/' /etc/apk/repositories; fi
RUN apk add --no-cache nginx nginx-mod-mail
# Add acme-lego Certbot
RUN curl -sL https://github.com/go-acme/lego/releases/download/v4.6.0/lego_v4.6.0_linux_amd64.tar.gz | tar -C /usr/sbin -xzf -
# Configuration
COPY etc/nginx/nginx.conf /etc/nginx
COPY etc/nginx/default.d /etc/nginx/default.d
COPY etc/nginx/include.d /etc/nginx/include.d
RUN chmod 444 /etc/nginx/default.d/ssl/* && chmod 400 /etc/nginx/default.d/ssl/default.key /etc/nginx/default.d/ssl/dhparams.pem
# Default SSL cert
RUN mkdir -p /etc/nginx/conf.d/ssl && ln -s ../../default.d/ssl/default.crt /etc/nginx/conf.d/ssl/mail.crt && ln -s ../../default.d/ssl/default.key /etc/nginx/conf.d/ssl/mail.key
COPY ssl.sh /usr/sbin/
COPY var/www/maintenance /var/www/maintenance
# Expose our web root and log directories log.
#VOLUME [ "/etc/nginx/conf.d", "/etc/nginx/default.d", "/etc/nginx/include.d" ]
# Starting
LABEL cron.container.weekly root#/usr/sbin/ssl.sh lego renew
ENTRYPOINT [ "/usr/sbin/nginx","-g","daemon off;" ]
EXPOSE 80 443 25 110 143