nginx/Dockerfile
2022-04-02 00:54:34 +11:00

31 lines
992 B
Docker

# NAME leenooks/nginx
# VERSION latest
FROM nginx:latest
COPY etc/nginx/default.d /etc/nginx/default.d
COPY etc/nginx/nginx.conf /etc/nginx
COPY var/www/maintenance /var/www/maintenance
RUN chmod 444 /etc/nginx/default.d/ssl/* && chmod 400 /etc/nginx/default.d/ssl/default.key /etc/nginx/default.d/ssl/dhparams.pem
RUN apt-get update && apt-get install certbot -yy \
&& rm -rf /var/lib/apt/lists/* /tmp/*
# Add Cloudflare Certbot
RUN apt-get update && apt-get install python3-certbot-dns-cloudflare -yy \
&& rm -rf /var/lib/apt/lists/* /tmp/*
# Add acme-lego Certbot
RUN curl -sL https://github.com/go-acme/lego/releases/download/v4.2.0/lego_v4.2.0_linux_amd64.tar.gz | tar -C /usr/local/sbin -xzf -
EXPOSE 80 443
COPY ssl.sh /usr/local/sbin/
LABEL cron.container.weekly root#/usr/local/sbin/ssl.sh lego renew
# Expose our web root and log directories log.
#VOLUME [ "/etc/nginx/conf.d", "/etc/nginx/default.d" ]
# Starting
ENTRYPOINT [ "/usr/sbin/nginx" ]
CMD [ "-g daemon off;" ]