Add debugging output + build script

This commit is contained in:
Nico Schottelius 2021-10-11 12:28:20 +09:00
parent 9bc4351c9f
commit 6f9c38783d
3 changed files with 30 additions and 2 deletions

View file

@ -1,7 +1,6 @@
FROM nginx:1.21.3-alpine
RUN apk update
RUN apk add certbot
RUN apk update && apk add certbot bind-tools
COPY entrypoint.sh /
CMD ["/entrypoint.sh"]

11
build.sh Executable file
View file

@ -0,0 +1,11 @@
#!/bin/sh
set -e
docker build -t ungleich-certbot .
while [ $# -ge 1 ]; do
tag=$1; shift
docker tag ungleich-certbot:latest ungleich/ungleich-certbot:${tag}
docker push ungleich/ungleich-certbot:${tag}
done

View file

@ -5,6 +5,24 @@ if [ -z "$DOMAIN" -o -z "$EMAIL" ]; then
exit 1
fi
# Check that the domain exists, if not wait for it
ipv6_addr=""
ipv4_addr=""
while [ -z "$ipv6_addr" -a -z "$ipv4_addr" ]; do
echo "Trying to resolve $DOMAIN via DNS ..."
# Resolve for IPv6 and for IPv6
ipv6_addr=$(dig +short "$DOMAIN" aaaa)
ipv4_addr=$(dig +short "$DOMAIN" a)
if [ -z -z "$ipv6_addr" -a -z "$ipv4_addr" ]; then
echo "Resolving $DOMAIN failed, waiting 5 seconds before retrying ..."
sleep 5
else
echo "Resolved domain $DOMAIN: ipv6: $ipv6_addr ipv4: $ipv4_addr"
fi
done
if [ "$STAGING" = no ]; then
STAGING=""
else