FROM python:3.11-slim

WORKDIR /app

# Системные зависимости для PyMuPDF, psycopg2 и т.п.
RUN apt-get update && apt-get install -y \
    build-essential \
    libpq-dev \
    poppler-utils \
    && rm -rf /var/lib/apt/lists/*

COPY requirements.txt /app/requirements.txt

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

COPY src/worker /app/worker

# Логи и данные
RUN mkdir -p /app/logs

ENV PYTHONUNBUFFERED=1

CMD ["python", "-m", "worker.app"]