diff --git a/sync/Dockerfile b/sync/Dockerfile index b50b306..4add938 100644 --- a/sync/Dockerfile +++ b/sync/Dockerfile @@ -1,14 +1,18 @@ -FROM mcr.microsoft.com/playwright:v1.47.0-jammy - +# Stage 1: build TypeScript +FROM node:20-slim AS builder WORKDIR /app - COPY package*.json ./ RUN npm ci --include=dev +COPY tsconfig.json ./ +COPY src ./src +RUN npm run build -# Install Chromium for Playwright +# Stage 2: runtime with Playwright +FROM mcr.microsoft.com/playwright:v1.47.0-jammy +WORKDIR /app +COPY package*.json ./ +RUN npm ci --omit=dev RUN npx playwright install chromium --with-deps - -COPY . . -RUN npm run build && npm prune --production +COPY --from=builder /app/dist ./dist CMD ["node", "dist/index.js"]