Files
starter/docker/entrypoint.sh
T

32 lines
1.4 KiB
Bash
Raw Normal View History

2026-07-03 16:42:22 +03:00
#!/bin/sh
set -e
# In development, install Composer deps if vendor is not present
if [ "$APP_ENV" != "production" ] && [ ! -f vendor/autoload.php ]; then
echo "[entrypoint] Installing Composer dependencies..."
git config --global --add safe.directory /var/www/html 2>/dev/null || true
composer install --no-interaction --prefer-dist
fi
# In development, the app dir is bind-mounted from a fresh checkout, so package
# assets (which the Dockerfile publishes at build time in production) need to be
# generated here instead. Cheap and idempotent, safe to repeat on every boot.
if [ "$APP_ENV" != "production" ]; then
php artisan vendor:publish --tag=core-assets --force --ansi --quiet
php artisan vendor:publish --tag=public --force --ansi --quiet
php artisan filament:assets --ansi --quiet
fi
# Everything below runs on every boot of app/queue/scheduler, possibly concurrently,
# so it must be idempotent and safe to run from multiple containers at once.
# Migrations, package publishing, and config/route/view caching are deploy-time
# concerns handled once via Envoy, not here.
mkdir -p storage/app/public storage/framework/cache storage/framework/sessions storage/framework/views storage/logs bootstrap/cache
chown -R www-data:www-data storage bootstrap/cache
chmod -R 775 storage bootstrap/cache
php artisan storage:link --quiet 2>/dev/null || true
exec "$@"