build(web): supply Verdaccio npm auth to SvelteKit builds via BuildKit secret

The sveltekit-base build (and the mana-web / manavoxel-web app builds on
top of it) run `pnpm install` with no .npmrc in the build context, so
private @mana/* packages resolved against registry.npmjs.org and 404'd
(e.g. @mana/shared-icons@1.0.0, which only lives on npm.mana.how). It had
been coasting on a warm pnpm cache; once sveltekit-base:local was gone the
rebuild hard-failed.

Mount the host ~/.npmrc (registry map + resolved _authToken) as a BuildKit
secret at /root/.npmrc in all three pnpm-install steps. Token never lands
in an image layer. build-app.sh passes it via --secret for the base build;
docker compose build reads it from the top-level secrets: entry.

Unblocks every managarten web rebuild (incl. the pending umami-removal).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Till JS 2026-05-26 15:43:23 +02:00
parent 7db881b026
commit bffb5be345
5 changed files with 43 additions and 6 deletions

View file

@ -71,8 +71,13 @@ COPY packages/shared-llm ./packages/shared-llm
COPY packages/shared-ai ./packages/shared-ai
COPY packages/cards-core ./packages/cards-core
# Install dependencies (shared packages only - app deps added later)
RUN --mount=type=cache,id=pnpm,target=/root/.local/share/pnpm/store \
# Install dependencies (shared packages only - app deps added later).
# The npmrc secret carries the Verdaccio (@mana:registry=npm.mana.how)
# auth token so private @mana/* packages resolve — without it pnpm falls
# back to registry.npmjs.org and 404s on e.g. @mana/shared-icons. Mounted
# as a BuildKit secret so the token never lands in an image layer.
RUN --mount=type=secret,id=npmrc,target=/root/.npmrc \
--mount=type=cache,id=pnpm,target=/root/.local/share/pnpm/store \
pnpm install --no-frozen-lockfile --ignore-scripts
# Ensure all @mana workspace packages are linked in node_modules