fix: provisions DB on container startup
This commit is contained in:
15
bash/entrypoint.sh
Normal file
15
bash/entrypoint.sh
Normal 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
|
||||
Reference in New Issue
Block a user