fix(docker): build assets on start when the manifest is missing
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 <noreply@anthropic.com>feat/portal-design
parent
08670ecbee
commit
300ea60f19
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue