Add startup script support

This commit is contained in:
Elliot Saba 2017-06-20 11:27:05 -07:00
parent 0a239137b0
commit 3d3a0be3cc
2 changed files with 9 additions and 0 deletions

View File

@ -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/*

View File

@ -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 &