fix: provisions DB on container startup

This commit is contained in:
2025-05-16 13:15:28 -05:00
parent cc4942a537
commit 7bc8720377
9 changed files with 231 additions and 2 deletions

15
bash/entrypoint.sh Normal file
View File

@@ -0,0 +1,15 @@
#!/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