FROM node:20-slim

# Install Playwright system dependencies
RUN npx playwright@1.50.0 install-deps chromium

WORKDIR /app

COPY package.json ./
RUN npm install
# Install Playwright browser
RUN npx playwright install chromium

COPY server.js ./

ENV NODE_ENV=production
EXPOSE 3100

HEALTHCHECK --interval=15s --timeout=5s --retries=3 CMD wget -qO- http://localhost:3100/health || exit 1

CMD ["node", "server.js"]
