#!/bin/bash # Sleep for a second to ensure DB is awake and ready SLEEP_TIME=$(shuf -i 2-5 -n 1) echo "> Sleeping for ${SLEEP_TIME} seconds to wait for the database" echo "> If there are errors after the migration runs, it's possible another container (scheduler, worker, etc.) already ran the migrations" sleep $SLEEP_TIME # Provision database php /var/www/bin/console doctrine:migrations:migrate --no-interaction php /var/www/bin/console doctrine:fixtures:load --no-interaction # Start Apache in the foreground echo "Starting Apache..." exec apachectl -D FOREGROUND exec "$@"