From d6407cdf7db83112b64806b88e4c5d3a8b733290 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 19 Jul 2021 22:56:51 +0200 Subject: [PATCH] Add support for only running once --- README.md | 8 +++++++- entrypoint.sh | 4 ++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ab36ae0..c5ceae9 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,12 @@ docker run -e DOMAIN=example.com \ ungleich/ungleich-certbot ``` +### Exiting after getting the certificate + +By default, the container will stay alive and try to renew the +certificate every 86400 seconds. If you set the environment variable +`ONLYGETCERT`, then it will only get the certificates and exit. + ## Volumes If you want to keep / use your certificates, you are advised to create @@ -35,4 +41,4 @@ a volume below /etc/letsencrypt. ## Kubernetes -Sample kubernetes usage: (TBD) +See https://code.ungleich.ch/ungleich-public/ungleich-k8s/. diff --git a/entrypoint.sh b/entrypoint.sh index 981dc27..a4f953d 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -26,6 +26,10 @@ while [ ! -f "/etc/letsencrypt/live/${DOMAIN}/fullchain.pem" ]; do fi done +if [ "$ONLYGETCERT" ]; then + exit 0 +fi + # Try to renew once per day while true; do /usr/bin/certbot renew