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 &