Created
June 4, 2019 22:34
-
-
Save hilios/8d9da34fde774f457704c887819557aa to your computer and use it in GitHub Desktop.
Let's Encrypt docker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ubuntu:18.04 | |
EXPOSE 80 443 | |
COPY ./credentials.json /etc/credentials.json | |
RUN apt-get update \ | |
&& apt-get install -y --no-install-recommends python-setuptools python-pip certbot lighttpd \ | |
&& pip install -U --no-cache-dir pip certbot certbot-dns-google \ | |
&& chmod a+rwx,u-x,g-rwx,o-rwx /etc/credentials.json \ | |
&& certbot certonly --non-interactive \ | |
--dns-google \ | |
--dns-google-credentials /etc/credentials.json \ | |
--dns-google-propagation-seconds 180 \ | |
--server https://acme-v02.api.letsencrypt.org/directory \ | |
--register-unsafely-without-email \ | |
--agree-tos \ | |
-d hilios.com.br \ | |
-d *.hilios.com.br \ | |
-d edsonhilios.com.br \ | |
-d *.edsonhilios.com.br \ | |
&& cat <<EOF > /etc/cron.daily/certbot | |
#!/bin/bash | |
certbot renew --post-hook "/etc/init.d/lighttpd restart" | |
cat /etc/letsencrypt/live/hilios.com.br/privkey.pem \ | |
/etc/letsencrypt/live/hilios.com.br/cert.pem \ | |
> /etc/letsencrypt/live/hilios.com.br/hilios.com.br.pem | |
EOF \ | |
&& chmod a+x /etc/cron.daily/certbot; | |
VOLUME /etc/letsencrypt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment