fix(docker): build web/ dashboard assets in image (#12180)

The Dockerfile installs root-level npm dependencies (for Playwright) and the
whatsapp-bridge bundle, but never builds the web/ Vite project. As a result,
'hermes dashboard' starts FastAPI on :9119 but serves a broken SPA because
hermes_cli/web_dist/ is empty and requests to /assets/index-<hash>.js 404.

Add a build step inside web/ so the Vite output is baked into the image.

Reproduce (before):
  docker build -t hermes-repro -f Dockerfile .
  docker run --rm -p 9119:9119 hermes-repro hermes dashboard
  curl -sI http://localhost:9119/assets/ | head -1   # -> 404

After: /assets/ returns the built asset path.
This commit is contained in:
bluefishs 2026-04-19 00:50:24 +08:00 committed by GitHub
parent c14b3b5880
commit b0bde98b0f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -31,6 +31,12 @@ RUN npm install --prefer-offline --no-audit && \
npm install --prefer-offline --no-audit && \
npm cache clean --force
# Build the web/ dashboard so FastAPI at :9119 can serve the Vite assets
RUN cd /opt/hermes/web && \
npm install --prefer-offline --no-audit && \
npm run build && \
npm cache clean --force
# Hand ownership to hermes user, then install Python deps in a virtualenv
RUN chown -R hermes:hermes /opt/hermes
USER hermes