From 300ea60f19d3507c3e6877c274e454042fad4ad4 Mon Sep 17 00:00:00 2001 From: nexxo Date: Sat, 25 Jul 2026 21:45:27 +0200 Subject: [PATCH] fix(docker): build assets on start when the manifest is missing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With the Vite dev server off by default, a fresh checkout had no public/build (gitignored, and the image does not build it), so every @vite page failed with ViteManifestNotFoundException. The entrypoint now builds once when the manifest is absent, non-fatally — a broken build must not wedge the container into a restart loop where the logs are unreachable. Proven by deleting public/build and restarting: assets rebuilt automatically, page 200. Co-Authored-By: Claude Opus 4.8 --- docker/entrypoint.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) 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