initial commit: add dockerfile

This commit is contained in:
DarkCat09 2025-02-18 22:57:34 +04:00
commit ffa7ecb115
Signed by: DarkCat09
GPG key ID: BD3CE9B65916CD82
2 changed files with 44 additions and 0 deletions

33
entrypoint.sh Normal file
View file

@ -0,0 +1,33 @@
#!/bin/ash
if [ ! -e /etc/letsencrypt ]
then
echo "[!!] Certbot directory is not initialized"
echo "[!!] Either it's the first run or you forgot to add a volume"
# check if stdin (fd 0) is assigned to a tty
[ ! -t 0 ] && echo "Not a TTY! Exiting" && exit 1
/venv/bin/certbot certonly --nginx
exit $?
fi
/usr/sbin/nginx -c /etc/nginx/nginx.conf &
ngpid=$!
waitpid=""
ctrlc () {
kill -QUIT "$ngpid"
[ -n "$waitpid" ] && kill -INT "$waitpid"
}
trap ctrlc INT
trap ctrlc TERM
while true
do
/venv/bin/certbot renew --post-hook "kill -HUP $ngpid"
sleep 12h &
waitpid=$!
wait
done