repo inicializado

This commit is contained in:
2026-03-17 00:48:20 -04:00
parent 157c93736c
commit 717cc11a03
33 changed files with 9416 additions and 197 deletions

9
certbot/Dockerfile Normal file
View File

@@ -0,0 +1,9 @@
FROM certbot/certbot
RUN apk add --no-cache bash
COPY certbot.sh /opt/
RUN chmod +x /opt/certbot.sh
ENTRYPOINT ["/opt/certbot.sh"]

57
certbot/certbot.sh Normal file
View File

@@ -0,0 +1,57 @@
#!/bin/bash
set -e
trap exit INT TERM
if [ -z "$DOMAINS" ]; then
echo "DOMAINS environment variable is not set"
exit 1;
fi
until nc -z nginx 80; do
echo "Waiting for nginx to start..."
sleep 5s & wait ${!}
done
if [ "$CERTBOT_TEST_CERT" != "0" ]; then
test_cert_arg="--test-cert"
fi
domains_fixed=$(echo "$DOMAINS" | tr -d \")
domain_list=($domains_fixed)
emails_fixed=$(echo "$CERTBOT_EMAILS" | tr -d \")
emails_list=($emails_fixed)
for i in "${!domain_list[@]}"; do
domain="${domain_list[i]}"
echo "Make cerbot directory for $domain";
mkdir -p /var/www/certbot/$domain;
echo "Make the $domain deep directory for acme-challenges";
mkdir -p /var/www/certbot/$domain/.well-known/acme-challenge;
if [ -d "/etc/letsencrypt/live/$domain" ]; then
echo "Let's Encrypt certificate for $domain already exists"
continue
fi
email="${emails_list[i]}"
if [ -z "$email" ]; then
email_arg="--register-unsafely-without-email"
echo "Obtaining the certificate for $domain without email"
else
email_arg="--email $email"
echo "Obtaining the certificate for $domain with email $email"
fi
certbot certonly \
--webroot \
-w "/var/www/certbot/$domain" \
-d "$domain" \
$test_cert_arg \
$email_arg \
--rsa-key-size "${CERTBOT_RSA_KEY_SIZE:-4096}" \
--agree-tos \
--noninteractive \
--verbose || true
done