- Entrypoint: run migrate + seed before caching config - docker-compose: pass ADMIN_EMAIL/ADMIN_PASSWORD/RUN_SEEDER to app - All 5 containers start healthy: app, postgres, nginx, pgadmin, adminer - Login page returns 200, API login works, migrations+seeding run on boot
37 lines
741 B
Bash
Executable File
37 lines
741 B
Bash
Executable File
#!/bin/bash
|
|
set -e
|
|
|
|
cd /var/www/html
|
|
|
|
if [ ! -f ".env" ]; then
|
|
if [ -f ".env.example" ]; then
|
|
cp .env.example .env
|
|
fi
|
|
fi
|
|
|
|
if [ ! -d "vendor" ]; then
|
|
composer install --no-dev --optimize-autoloader --no-interaction || true
|
|
fi
|
|
|
|
if [ ! -d "node_modules" ] && [ -f "package.json" ]; then
|
|
npm install || true
|
|
fi
|
|
|
|
if [ ! -d "public/build" ] && [ -f "vite.config.js" ]; then
|
|
npm run build || true
|
|
fi
|
|
|
|
if [ "$RUN_MIGRATIONS" = "true" ]; then
|
|
php artisan migrate --force || true
|
|
fi
|
|
|
|
if [ "$RUN_SEEDER" = "true" ]; then
|
|
php artisan db:seed --force 2>/dev/null || true
|
|
fi
|
|
|
|
php artisan config:cache 2>/dev/null || true
|
|
php artisan route:cache 2>/dev/null || true
|
|
php artisan view:cache 2>/dev/null || true
|
|
|
|
exec "$@"
|