From 3d3a0be3ccb1c4e63e7a88f86d78f16653ffa2b7 Mon Sep 17 00:00:00 2001 From: Elliot Saba Date: Tue, 20 Jun 2017 11:27:05 -0700 Subject: [PATCH] Add startup script support --- Dockerfile | 3 +++ scripts/entrypoint.sh | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/Dockerfile b/Dockerfile index e987d4e..484f7f9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -22,6 +22,9 @@ RUN crontab /etc/cron.d/certbot COPY ./scripts/ /scripts RUN chmod +x /scripts/*.sh +# Add /scripts/startup directory to source more startup scripts +RUN mkdir -p /scripts/startup + # Copy in default nginx configuration (which just forwards ACME requests to # certbot, or redirects to HTTPS, but has no HTTPS configurations by default). RUN rm -f /etc/nginx/conf.d/* diff --git a/scripts/entrypoint.sh b/scripts/entrypoint.sh index 73d38d1..bbc54a7 100644 --- a/scripts/entrypoint.sh +++ b/scripts/entrypoint.sh @@ -17,6 +17,12 @@ export NGINX_PID=$! # Next, run certbot to request all the ssl certs we can find /scripts/run_certbot.sh +# Lastly, run startup scripts +for f in /scripts/startup/*.sh; do + echo "Running startup script $f" + $f +done + # Run `cron -f &` so that it's a background job owned by bash and then `wait`. # This allows SIGINT (e.g. CTRL-C) to kill cron gracefully, due to our `trap`. cron -f &