++stuff
This commit is contained in:
parent
8110edc659
commit
30384ff32a
7 changed files with 106 additions and 19 deletions
4
containers/ungleich-nginx/Dockerfile
Normal file
4
containers/ungleich-nginx/Dockerfile
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
FROM nginx:1.21-alpine
|
||||
|
||||
COPY watch-and-run.sh /
|
||||
ENTRYPOINT /docker-entrypoint.sh /watch-and-run.sh
|
||||
30
containers/ungleich-nginx/watch-and-run.sh
Executable file
30
containers/ungleich-nginx/watch-and-run.sh
Executable 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue