docker-nginx-certbot/Dockerfile

34 lines
676 B
Docker

FROM ubuntu:22.04
# set timezone
ENV TIMEZONE=Asia/Seoul
RUN ln -snf /usr/share/zoneinfo/${TIMEZONE} /etc/localtime
# install nginx cerbot etc.
RUN apt-get update -y \
&& apt-get install -y \
cron \
nginx \
certbot \
python3-certbot-nginx \
python3-certbot-dns-cloudflare \
&& rm -rf /var/cache/apk/*
# setup nginx
RUN echo "daemon off;" >> /etc/nginx/nginx.conf && chown -R www-data:www-data /var/lib/nginx
# expose port
EXPOSE 80 443
# work dir
WORKDIR /home
ADD acme-challenge.conf .
ADD create-cert-cloudflare.sh .
ADD entrypoint.sh .
# crontab add
RUN chmod +x entrypoint.sh create-cert-cloudflare.sh
# Run
CMD ["/home/entrypoint.sh"]