FROM python:3.12-slim

ENV PYTHONDONTWRITEBYTECODE=1 \
    PYTHONUNBUFFERED=1 \
    PORT=8091 \
    CHROME_PATH=/usr/bin/chromium

WORKDIR /app

RUN apt-get update \
    && apt-get install -y --no-install-recommends \
      chromium \
      fonts-noto-cjk \
      nodejs \
      npm \
    && rm -rf /var/lib/apt/lists/*

COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt

RUN npm install --omit=dev playwright-core

COPY mysql_preview_server.py \
     index.html \
     detail-view.html \
     detail-view-project.html \
     mysql-preview.html \
     people-unified.html \
     project-codes.html \
     ./

EXPOSE 8091 8092

CMD ["python3", "mysql_preview_server.py"]
