npm silently skips devDependencies in some Alpine+npm combinations, causing tsc to be missing even after npm install. Moving typescript to regular dependencies guarantees it is always installed and its .bin symlink is created regardless of NODE_ENV. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
20 lines
505 B
Docker
20 lines
505 B
Docker
# Stage 1: build TypeScript
|
|
FROM node:20-alpine AS builder
|
|
WORKDIR /app
|
|
RUN apk add --no-cache python3 make g++
|
|
COPY package*.json .npmrc ./
|
|
RUN npm install
|
|
COPY tsconfig.json ./
|
|
COPY src ./src
|
|
RUN npm run build && npm prune --production
|
|
|
|
# Stage 2: runtime with Playwright
|
|
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
|
|
|
|
CMD ["node", "dist/index.js"]
|
|
|