FROM python:3.11-slim

WORKDIR /app

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

# Python deps
COPY pyproject.toml .
RUN pip install --no-cache-dir openpyxl typer pyyaml pydantic \
    faiss-cpu openai python-telegram-bot pymupdf Pillow

# App code
COPY src/ src/
COPY resources.json .
COPY data/ data/

# Install package
RUN pip install --no-cache-dir -e .

# Pre-build FAISS index if not exists
# (will be built on first run if missing)

ENV PYTHONUNBUFFERED=1

CMD ["smeta", "bot"]
