27 lines
601 B
Bash
27 lines
601 B
Bash
#!/bin/bash
|
|
set -e
|
|
|
|
|
|
# Create .env if missing
|
|
if [ ! -f /var/www/html/.env ]; then
|
|
cp /var/www/html/.env.example /var/www/html/.env
|
|
php artisan key:generate
|
|
fi
|
|
|
|
# Fix ownership and permissions
|
|
chown -R www-data:www-data /var/www/html/storage /var/www/html/bootstrap/cache
|
|
chmod -R 775 /var/www/html/storage /var/www/html/bootstrap/cache
|
|
|
|
# Wait for MySQL to be ready
|
|
echo "Waiting for MySQL to be ready..."
|
|
while ! mysqladmin ping -h"mysql" -u"root" -p"rootpassword" --silent; do
|
|
sleep 1
|
|
done
|
|
echo "MySQL is ready!"
|
|
|
|
# Run migrations
|
|
php artisan migrate --force
|
|
|
|
# Start PHP-FPM
|
|
exec "$@"
|