diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index ad4f146..ad07425 100644 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -24,6 +24,16 @@ if [ "$role" = "app" ]; then rm -f public/hot [ -f vendor/autoload.php ] || www "composer install --no-interaction --prefer-dist --no-progress" [ -x node_modules/.bin/vite ] || www "npm install --no-fund --no-audit" + # With the Vite dev server off (the default for domain/HTTPS operation), + # @vite needs the built manifest — and public/build is gitignored, so a + # fresh checkout has none. Build it once instead of failing every page with + # ViteManifestNotFoundException. + if [ "${VITE_AUTOSTART:-false}" != "true" ] && [ ! -f public/build/manifest.json ]; then + # Non-fatal: a broken build must not wedge the container in a restart + # loop where the logs are unreachable — nginx still comes up and the + # error is visible in the browser. + www "npm run build" || echo "clupilot-entrypoint: asset build FAILED — run 'npm run build' manually" + fi if [ -f .env ] && ! grep -qE '^APP_KEY=.+' .env; then www "php artisan key:generate --force" || true fi