- Add multi-stage Dockerfile (node-builder, composer-builder, production) - Add Nginx config with WebSocket proxy at /_ws path - Add PHP-FPM pool config, php.ini with OPcache tuning - Add Supervisord managing 7 processes: php-fpm, nginx, horizon, scheduler, reverb, pulse-check, pulse-work - Add entrypoint.sh with auto-migration, config caching, storage setup - Add .dockerignore and .env.production.example - Install laravel/horizon for production queue management and dashboard - Install laravel/pulse for production monitoring with Reverb integration - Configure TrustProxies middleware for HTTPS behind Traefik - Add horizon:snapshot to scheduler - Add VITE_REVERB_PATH for WebSocket path routing through Nginx
35 lines
986 B
Bash
35 lines
986 B
Bash
#!/bin/sh
|
|
set -e
|
|
|
|
echo "Starting iMail container initialization..."
|
|
|
|
# Ensure storage directories exist
|
|
mkdir -p /var/www/html/storage/framework/cache/data
|
|
mkdir -p /var/www/html/storage/framework/sessions
|
|
mkdir -p /var/www/html/storage/framework/views
|
|
mkdir -p /var/www/html/storage/logs
|
|
mkdir -p /var/www/html/storage/app/public
|
|
mkdir -p /var/www/html/bootstrap/cache
|
|
|
|
# Fix permissions
|
|
chown -R www-data:www-data /var/www/html/storage
|
|
chown -R www-data:www-data /var/www/html/bootstrap/cache
|
|
|
|
# Cache configuration, routes, views, events
|
|
echo "Caching configuration and routes..."
|
|
php artisan config:cache
|
|
php artisan route:cache
|
|
php artisan view:cache
|
|
php artisan event:cache
|
|
|
|
# Create storage symlink
|
|
php artisan storage:link
|
|
|
|
# Run migrations automatically
|
|
echo "Running migrations..."
|
|
php artisan migrate --force
|
|
|
|
echo "Initialization complete. Starting Supervisord..."
|
|
# Execute supervisord in the foreground
|
|
exec /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf
|