Files
ssl-nginx/nginx/Dockerfile
kanootoko 16bc1c0db7 update 2024-04-22
Changes:
- add jinja2 template engine instead of string-replacing
- fix certbot cron usage
- replace json servers configuration with yaml
2024-04-22 21:53:47 +03:00

28 lines
795 B
Docker

FROM python:3.11-alpine as builder
RUN pip3 install --no-cache-dir pyyaml jinja2
COPY add_servers.py /add_servers.py
COPY servers.yaml /servers.yaml
COPY domains.txt /domains.txt
COPY nginx.conf.j2 /nginx.conf.j2
RUN python /add_servers.py --nginx-template /nginx.conf.j2 -o /nginx.conf --domains_list_txt /domains.txt --servers-config servers.yaml --certificates-path /ssl
# service
FROM nginx:alpine
COPY --from=builder /nginx.conf /etc/nginx/nginx.conf
COPY domains.txt /domains.txt
RUN echo "16 2 */7 * * nginx -s reload" > /etc/crontabs/root && \
\
echo "cp /domains.txt /ssl/domains.txt" > /entrypoint && \
echo "crond" >> /entrypoint && \
echo "nginx -g 'daemon off;'" >> /entrypoint && \
echo "nginx" >> /entrypoint
ENTRYPOINT ["/bin/sh"]
CMD ["/entrypoint"]