PteroTheme/.dev/docker/entrypoint.sh

39 lines
845 B
Bash
Raw Normal View History

2018-05-18 03:53:17 +01:00
#!/bin/ash
2018-08-05 00:21:51 +01:00
## Ensure we are in /app
2018-05-18 14:11:33 +01:00
cd /app
2018-08-05 00:21:51 +01:00
## check for .env file and generate app keys if missing
if [ -f /app/var/.env ]; then
echo "external vars exist"
rm /app/.env
ln -s /app/var/.env /app/
else
echo "external vars don't exist"
php artisan key:generate --force
cp /app/.env /app/var/
fi
2018-05-18 03:53:17 +01:00
2018-08-05 00:21:51 +01:00
## check for DB up before starting the panel
echo "Checking database status."
2018-05-18 03:53:17 +01:00
until nc -z -v -w30 $DB_HOST 3306
2018-08-05 00:21:51 +01:00
2018-05-18 03:53:17 +01:00
do
echo "Waiting for database connection..."
# wait for 5 seconds before check again
sleep 5
done
2018-08-05 00:21:51 +01:00
## make sure the db is set up
php artisan migrate --seed --force
2018-05-18 13:55:12 +01:00
2018-08-05 00:21:51 +01:00
echo -e "Done\n"
2018-05-18 13:55:12 +01:00
2018-08-05 00:21:51 +01:00
## start php-fpm in the background
echo -e "Starting php-fpm in the background. \n"
php-fpm7 -D
echo -e "php-fpm starte.d \n"
## start webserver
echo -e "Starting nginx in the foreground. \n"
nginx -g 'pid /tmp/nginx.pid; daemon off;'