laravel_initial/entrypoint.sh

32 lines
897 B
Bash
Executable File

#!/bin/sh
# Wait for MySQL to be ready
echo "⏳ Waiting for MySQL to start..."
until nc -z -v -w30 mysql 3306; do
echo "Waiting for MySQL..."
sleep 5
done
echo "✅ MySQL is up and running!"
# Fix ownership and permissions for storage and cache directories
echo "🔧 Setting permissions for storage and cache..."
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
echo "✅ Permissions set successfully!"
# Run Laravel migrations
php artisan migrate --force
# Start PHP-FPM
exec "$@"
# #!/bin/bash
# # Fix ownership and permissions for storage directories
# 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
# # Run migrations
# php artisan migrate --force
# # Start PHP-FPM
# exec "$@"