Merge pull request #18281 from NousResearch/bb/fix-tui-docker-ink-v2

fix: prevent tui rebuilding assets
This commit is contained in:
Ben Barclay 2026-05-01 18:43:40 +10:00 committed by GitHub
commit 0159f25fd0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 24 additions and 8 deletions

View file

@ -9,6 +9,12 @@ node_modules
.venv .venv
**/.venv **/.venv
# Built artifacts that are regenerated inside the image. Excluded so local
# rebuilds on the developer's machine don't invalidate the npm-install layer
# that now depends on the full ui-tui/packages/hermes-ink/ tree being present.
ui-tui/dist/
ui-tui/packages/hermes-ink/dist/
# CI/CD # CI/CD
.github .github

View file

@ -28,10 +28,26 @@ WORKDIR /opt/hermes
# ---------- Layer-cached dependency install ---------- # ---------- Layer-cached dependency install ----------
# Copy only package manifests first so npm install + Playwright are cached # Copy only package manifests first so npm install + Playwright are cached
# unless the lockfiles themselves change. # unless the lockfiles themselves change.
#
# ui-tui/packages/hermes-ink/ is copied IN FULL (not just its manifests)
# because it is referenced as a `file:` workspace dependency from
# ui-tui/package.json. Copying the tree up front lets npm resolve the
# workspace to real content instead of stopping at a bare package.json.
COPY package.json package-lock.json ./ COPY package.json package-lock.json ./
COPY web/package.json web/package-lock.json web/ COPY web/package.json web/package-lock.json web/
COPY ui-tui/package.json ui-tui/package-lock.json ui-tui/ COPY ui-tui/package.json ui-tui/package-lock.json ui-tui/
COPY ui-tui/packages/hermes-ink/package.json ui-tui/packages/hermes-ink/package-lock.json ui-tui/packages/hermes-ink/ COPY ui-tui/packages/hermes-ink/ ui-tui/packages/hermes-ink/
# `npm_config_install_links=false` forces npm to install `file:` deps as
# symlinks (the npm 10+ default) even on Debian's older bundled npm 9.x,
# which defaults to `install-links=true` and installs file deps as *copies*.
# The host-side package-lock.json is generated with a newer npm that uses
# symlinks, so an install-as-copy produces a hidden node_modules/.package-lock.json
# that permanently disagrees with the root lock on the @hermes/ink entry.
# That disagreement trips the TUI launcher's `_tui_need_npm_install()`
# check on every startup and triggers a runtime `npm install` that then
# fails with EACCES (node_modules/ is root-owned from build time).
ENV npm_config_install_links=false
RUN npm install --prefer-offline --no-audit && \ RUN npm install --prefer-offline --no-audit && \
npx playwright install --with-deps chromium --only-shell && \ npx playwright install --with-deps chromium --only-shell && \
@ -45,13 +61,7 @@ COPY --chown=hermes:hermes . .
# Build browser dashboard and terminal UI assets. # Build browser dashboard and terminal UI assets.
RUN cd web && npm run build && \ RUN cd web && npm run build && \
cd ../ui-tui && npm run build && \ cd ../ui-tui && npm run build
rm -rf node_modules/@hermes/ink && \
rm -rf packages/hermes-ink/node_modules && \
cp -R packages/hermes-ink node_modules/@hermes/ink && \
npm install --omit=dev --prefer-offline --no-audit --prefix node_modules/@hermes/ink && \
rm -rf node_modules/@hermes/ink/node_modules/react && \
node --input-type=module -e "await import('@hermes/ink')"
# ---------- Permissions ---------- # ---------- Permissions ----------
# Make install dir world-readable so any HERMES_UID can read it at runtime. # Make install dir world-readable so any HERMES_UID can read it at runtime.