fix: commit pre-compiled dist and simplify sync Dockerfile

Server npm proxy silently drops devDependencies, making TypeScript
unavailable in Docker. Solution: compile locally and commit dist/.
Dockerfile now only needs prod deps + Playwright, both of which
install cleanly via the public registry.

Also fix TS2688/TS2304 errors: add DOM to tsconfig lib and cast
querySelectorAll results to Element inside $$eval callbacks.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Matthias Hochmeister
2026-03-01 13:51:48 +01:00
parent acd1506df8
commit 02797554aa
8 changed files with 437 additions and 18 deletions

View File

@@ -1,19 +1,11 @@
# Stage 1: build TypeScript
FROM node:20-slim AS builder
WORKDIR /app
RUN npm install -g typescript --registry https://registry.npmjs.org
COPY package.json package-lock.json ./
RUN npm install --registry https://registry.npmjs.org
COPY tsconfig.json ./
COPY src ./src
RUN tsc && npm prune --production --registry https://registry.npmjs.org
# Stage 2: runtime with Playwright
# dist/ is compiled locally and committed to the repo.
# The server npm proxy blocks devDependency installs inside Docker.
FROM mcr.microsoft.com/playwright:v1.47.0-jammy
WORKDIR /app
RUN npx playwright install chromium --with-deps
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/dist ./dist
COPY package.json package-lock.json ./
RUN npm install --omit=dev --registry https://registry.npmjs.org
COPY dist ./dist
CMD ["node", "dist/index.js"]