FROM python:3.12-slim

ENV PYTHONDONTWRITEBYTECODE=1 \
    PYTHONUNBUFFERED=1 \
    PYTHONUTF8=1

WORKDIR /app

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

COPY . ./

# Wortliste während des Builds erzeugen (nutzt data/openthesaurus.txt, falls vorhanden)
RUN python scripts/generate_wordlist.py

EXPOSE 8000

# Starte Flask-App via Gunicorn (3 Worker, Thread-Worker)
CMD ["gunicorn", "-w", "3", "-k", "gthread", "--threads", "2", "-b", "0.0.0.0:8000", "app:app"]
