FROM node:20-slim

RUN apt-get update && \
    apt-get install -y --no-install-recommends curl && \
    rm -rf /var/lib/apt/lists/*

WORKDIR /app

COPY package.json package-lock.json* ./
RUN npm install

# Install Chromium for Playwright
RUN npx playwright install --with-deps chromium

COPY tsconfig.json ./
COPY src/ src/
RUN npm run build

EXPOSE 8002

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