Files
ogrechkoandClaude Sonnet 5 ea6c43f5af Fix production build: npm registry flakiness, stray package-lock.json dir, TS error
- registry.npmjs.org was intermittently ETIMEDOUT mid-download from this
  host; switched to registry.npmmirror.com (also raised npm's own retry
  budget as a second line of defense).
- frontend/package-lock.json on disk was actually an empty directory
  (untracked, root-owned — a stray artifact, likely from an old bad
  bind-mount), which broke `COPY . .` once npm install got past it.
- documents/page.tsx had a real type error (selectedItem.file narrowing
  didn't survive into the .map() closure) that `next dev` never
  surfaced but `next build`'s stricter check does — fixed by hoisting
  the narrowed array into selectedFiles once instead of re-narrowing
  selectedItem.file at each use.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Gh2UXUQUVBWroWEnn1FLFG
2026-09-03 05:18:49 +00:00

26 lines
928 B
Docker

FROM node:22-bookworm-slim
WORKDIR /app
# registry.npmjs.org resolves to Cloudflare's IPv6-only records here, and
# Docker's default bridge network has flaky IPv6 egress — Node's Happy
# Eyeballs then hangs on IPv6 before timing out instead of falling back to
# IPv4 quickly, causing intermittent ETIMEDOUT mid-install.
ENV NODE_OPTIONS=--dns-result-order=ipv4first
COPY package.json package-lock.json* ./
# registry.npmjs.org itself is unreliable from this host (mid-download
# stalls even with aggressive npm retries) — route through npmmirror.com
# instead, which is consistently reachable from this network.
RUN npm config set registry https://registry.npmmirror.com && \
npm config set fetch-retries 8 && \
npm config set fetch-retry-mintimeout 20000 && \
npm config set fetch-retry-maxtimeout 120000 && \
npm install
COPY . .
RUN npm run build
CMD ["npm", "start", "--", "--hostname", "0.0.0.0"]