commit 3eef461208846be4dcc9a4c4ad065af8ec9ba07c Author: gyurix Date: Sat Jul 3 05:59:28 2021 +0000 Initial setup for neilpang/acme.sh docker image. diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..ba4dc80 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,7 @@ +FROM neilpang/acme.sh:latest +MAINTAINER gyurix + +RUN apk update && apk add --no-cache jq +COPY ./start.letsencrypt.sh /start.letsencrypt.sh + +ENTRYPOINT ["/start.letsencrypt.sh"] diff --git a/start.letsencrypt.sh b/start.letsencrypt.sh new file mode 100755 index 0000000..da4d5dc --- /dev/null +++ b/start.letsencrypt.sh @@ -0,0 +1,35 @@ +#!/bin/sh + +#apk update +#apk add --no-cache jq + +cd /domains + +email=$EMAIL + +start_letsencrypt() { + + mkdir -p /acme.sh/$DOMAIN/ ; + + acme.sh --register-account -m $email --issue --standalone --keylength 4096 -d $DOMAIN --cert-file /acme.sh/$DOMAIN/cert.pem --key-file /acme.sh/$DOMAIN/key.pem --fullchain-file /acme.sh/$DOMAIN/fullchain.pem ; + + #mkdir -p /acme.sh/$DOMAIN/ecc-certs ; + + #acme.sh --issue --standalone --keylength ec-384 -d $DOMAIN --cert-file /acme.sh/$DOMAIN/ecc-certs/cert.pem --key-file /acme.sh/$DOMAIN/ecc-certs/key.pem --fullchain-file /acme.sh/$DOMAIN/ecc-certs/fullchain.pem + +} + +LETSENCRYPT_FILE=$(find . -type f -name letsencrypt); +if [ -n "$LETSENCRYPT_FILE" ] ; then + DOMAIN=$(jq -r .DOMAIN $LETSENCRYPT_FILE) ; + start_letsencrypt; + rm $LETSENCRYPT_FILE; +else + for i in `ls` ; do + DOMAIN=$(jq -r .DOMAIN $i) ; + start_letsencrypt; + touch /acme.sh/$DOMAIN/new_certificate + done ; +fi + +