clrghouz/init-php.sh

24 lines
603 B
Bash
Raw Normal View History

#!/bin/bash
2021-06-24 10:36:27 +00:00
# Run our web init startup
2021-06-24 11:31:02 +00:00
rm -f bootstrap/cache/*.php
2021-06-24 10:36:27 +00:00
/sbin/init php-fpm &
# Wait for DB to start
# If DB_HOST not set, source the env file
[ -z "${DB_HOST}" -a -r .env ] && . .env
2021-06-24 11:31:02 +00:00
while ! wait-for-it -h ${DB_HOST} -p ${DB_PORT} -t 15 -q; do
echo "? Waiting for database at ${DB_HOST}:${DB_PORT}"
2021-06-24 11:31:02 +00:00
done
echo "- DB is active on ${DB_HOST}:${DB_PORT}"
2021-06-24 11:31:02 +00:00
# Wait for our config to have been rebuild
while [ ! -e bootstrap/cache/config.php -o -e .migrate ]; do
echo "? Waiting for configuration to be built by init"
sleep 15;
done
echo "* Ready to start server"
2021-06-24 10:36:27 +00:00
exec ./artisan server:start