This commit is contained in:
Nico Schottelius 2021-06-20 10:27:20 +02:00
commit 30384ff32a
7 changed files with 106 additions and 19 deletions

View file

@ -0,0 +1,4 @@
FROM nginx:1.21-alpine
COPY watch-and-run.sh /
ENTRYPOINT /docker-entrypoint.sh /watch-and-run.sh

View file

@ -0,0 +1,30 @@
#!/bin/sh
if [ -z ${DOMAIN} ]; then
exit 0
fi
file=/etc/letsencrypt/live/${DOMAIN}/fullchain.pem
while [ ! -f $file ]; do
echo "Waiting for ${file} ..."
sleep 2
done
# Now we can start nginx as a daemon
nginx
cksum=$(cksum $file)
cksum_new=$cksum
# Check every 10 minutes for new certs
# If they are there, reload nginx
while true; do
cksum_new=$(cksum $file)
if [ $cksum != $cksum_new ]; then
nginx -s reload
cksum=$cksum_new
fi
sleep 600
done