incr/docker/production/start-app.sh

29 lines
812 B
Bash
Raw Permalink Normal View History

2025-07-15 20:36:49 +02:00
#!/bin/sh
# Copy public files to shared volume if needed
cp -r /var/www/html/public/. /var/www/html/public_shared/ 2>/dev/null || true
2025-07-27 21:08:23 +02:00
# Create .env file if it doesn't exist
if [ ! -f /var/www/html/.env ]; then
cp /var/www/html/.env.example /var/www/html/.env 2>/dev/null || touch /var/www/html/.env
fi
# Wait for database to be ready
echo "Waiting for database..."
until php artisan tinker --execute="DB::connection()->getPdo();" 2>/dev/null; do
echo "Database not ready, waiting..."
sleep 2
done
echo "Database is ready!"
# Generate app key if not set
php artisan key:generate --force
2025-07-15 20:36:49 +02:00
# Laravel optimizations
php artisan config:cache
php artisan route:cache
php artisan view:cache
php artisan migrate --force
# Start supervisor to manage nginx and php-fpm
supervisord -c /etc/supervisord.conf