Files
investbrain/docker/entrypoint.sh
T

45 lines
1.4 KiB
Bash
Raw Normal View History

2024-09-04 17:48:40 -05:00
#!/bin/bash
2024-09-05 21:34:09 -05:00
cd /var/www/app
2024-09-05 18:32:29 -05:00
echo "====================== Running entrypoint script... ====================== "
2024-09-05 21:34:09 -05:00
if [ ! -f ".env" ]; then
2024-09-04 18:41:04 -05:00
echo " > Ope, gotta create an .env file!"
2024-09-04 17:48:40 -05:00
2024-09-05 21:34:09 -05:00
cp .env.example .env
2024-09-04 17:48:40 -05:00
fi
2024-09-05 21:34:09 -05:00
echo "====================== Checking for updates... ====================== "
/usr/bin/git pull
2024-09-05 18:32:29 -05:00
echo "====================== Installing Composer dependencies... ====================== "
/usr/local/bin/composer install
2024-09-05 21:49:06 -05:00
echo "====================== Validating environment... ====================== "
2024-09-09 14:49:34 -05:00
if [ $(stat -c '%U' .) != "www-data" ]; then
echo " > Setting correct permissions for pwd..."
chown -R www-data:www-data .
2024-09-08 21:36:37 -05:00
fi
2024-09-05 21:49:06 -05:00
if ( ! grep -q "^APP_KEY=" ".env" || grep -q "^APP_KEY=$" ".env"); then
echo " > Ah, APP_KEY is missing in .env file. Generating a new key!"
/usr/local/bin/php artisan key:generate --force
fi
2024-09-09 17:21:08 -05:00
if [ ! -L "public/storage" ]; then
echo " > Creating symbolic link for app public storage..."
/usr/local/bin/php artisan storage:link
fi
2024-09-05 21:49:06 -05:00
echo "====================== Installing NPM dependencies and building frontend... ====================== "
/usr/bin/npm install
/usr/bin/npm run build
2024-09-04 17:48:40 -05:00
2024-09-05 18:32:29 -05:00
echo "====================== Running migrations... ====================== "
2024-09-05 21:34:09 -05:00
/usr/local/bin/php artisan migrate --force
2024-09-04 17:48:40 -05:00
2024-09-05 18:32:29 -05:00
echo "====================== Spinning up Supervisor daemon... ====================== "
2024-09-04 17:48:40 -05:00
exec /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf