incr/docker/production/start-app.sh
myrmidex fe3711e57c
All checks were successful
CI / ci (push) Successful in 14m35s
CI / build (push) Successful in 45s
39 - Add multi-arch build pipeline, fix prod Dockerfile, add .dockerignore
2026-05-02 11:29:26 +02:00

31 lines
No EOL
900 B
Bash

#!/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
# 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 only if not already set
if ! grep -q "APP_KEY=base64:" /var/www/html/.env 2>/dev/null; then
php artisan key:generate --force
fi
# 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