Files

48 lines
2.2 KiB
Bash

#!/bin/sh
set -e
# Only the app container runs setup; queue/scheduler use entrypoint-worker.sh instead
# and just wait on the migrated marker this script writes below.
if [ "$APP_ENV" != "production" ]; 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
# Re-resolve boboko/* on every boot, whether it's a local path-repo checkout
# (../boboko-core mounted via docker-compose.core-dev.yml) or a VCS tag. Rewrites
# composer.lock, which is committed so prod picks up the resolved version via
# `composer install` alone.
echo "[entrypoint] Re-resolving boboko/* packages..."
composer update "boboko/*" --no-interaction --with-all-dependencies
fi
mkdir -p storage/app/public storage/framework/cache storage/framework/sessions storage/framework/views storage/logs storage/framework 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
if [ "$APP_ENV" != "production" ]; then
# 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.
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
echo "[entrypoint] Running migrations..."
rm -f storage/framework/migrated
php artisan migrate --force
touch storage/framework/migrated
# boboko/core overrides lunar:install to skip the interactive prompts (migrate
# confirm, admin creation, GitHub star) and just seed the idempotent store
# defaults: countries, channel, language, currency, tax zone, attributes,
# product type. queue/scheduler wait on the marker above rather than running
# this themselves, since the country import's check-then-insert isn't safe to
# run concurrently.
php artisan lunar:install --quiet || true
fi
exec "$@"