Docker_Laravel/entrypoint.sh

26 lines
685 B
Bash

#!/bin/sh
set -x # Enable debug mode to log each command
echo "Waiting for MySQL..."
sleep 20
echo "Checking for vendor directory..."
if [ ! -d "/var/www/html/vendor" ]; then
echo "ERROR: vendor directory not found. It should have been created during the build."
echo "Attempting to run composer install as a fallback..."
if ! composer install --optimize-autoloader --no-dev --ignore-platform-reqs; then
echo "ERROR: composer install failed"
composer diagnose
exit 1
fi
fi
echo "Running migrations..."
if ! php artisan migrate --force; then
echo "ERROR: php artisan migrate failed"
exit 1
fi
echo "Starting PHP-FPM..."
exec php-fpm