commit a2dee7c438b21d4205c637a458fe771af4b9e0f4 Author: Roxie Gibson Date: Thu Nov 11 10:55:15 2021 +0000 inital commit diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..82e16f3 --- /dev/null +++ b/.drone.yml @@ -0,0 +1,22 @@ +--- +kind: pipeline +name: docker-publish +steps: + - name: publish image + image: plugins/docker + settings: + auto_tag: true + username: thecoopcloud + password: + from_secret: thecoopcloud_password + repo: thecoopcloud/traefik-cert-dumper + tags: latest + when: + event: + exclude: + - pull_request + +trigger: + branch: + - main + diff --git a/DockerFile b/DockerFile new file mode 100644 index 0000000..3bd2c32 --- /dev/null +++ b/DockerFile @@ -0,0 +1,4 @@ +FROM ldez/traefik-certs-dumper:2.7.4 +COPY entrypoint.sh /opt/entrypoint.sh +COPY post-script.sh /opt/post-hook.sh +ENTRYPOINT /opt/entrypoint.sh diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 0000000..f94a480 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,4 @@ +while ! [ -e /traefik/production-acme.json ] || ! [ `jq ".production.Certificates | length" /traefik/production-acme.json` != 0 ]; do + sleep 1 + ; done +&& traefik-certs-dumper file --watch --source /traefik/production-acme.json --dest /output --domain-subdir=true --version v2 --post-hook "/opt/post-hook.sh" diff --git a/post-hook.sh b/post-hook.sh new file mode 100644 index 0000000..11d1941 --- /dev/null +++ b/post-hook.sh @@ -0,0 +1 @@ +find /output/ -depth -type d ! -name "${DOMAIN}" ! -name "." -execdir rm -r "{}" +