#!/bin/bash set -e # 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 "$@"