FROM node:20-bookworm-slim WORKDIR /app # Install dependencies first (layer-cached until package.json changes) COPY package*.json ./ RUN npm ci --omit=dev # Install Chromium and all required system dependencies via Playwright's installer RUN npx playwright install chromium --with-deps # Copy application source COPY src/ ./src/ COPY .env.example ./ ENV NODE_ENV=production EXPOSE 3000 HEALTHCHECK --interval=30s --timeout=10s --start-period=25s --retries=3 \ CMD node -e "\ const http = require('http'); \ http.get('http://localhost:3000/health', (r) => { \ process.exit(r.statusCode === 200 ? 0 : 1); \ }).on('error', () => process.exit(1));" CMD ["node", "src/server.js"]