FROM node:22-slim

# Python + libs for file processing + smeta-railway deps
# catdoc — старые .doc (OLE2); tesseract-ocr + rus — OCR PDF-сканов
RUN apt-get update && apt-get install -y --no-install-recommends \
    python3 python3-pip python3-venv \
    catdoc tesseract-ocr tesseract-ocr-rus && \
    rm -rf /var/lib/apt/lists/*

RUN pip3 install --break-system-packages --no-cache-dir \
    openpyxl python-docx pymupdf pandas \
    faiss-cpu pyyaml pydantic typer openai rank-bm25 \
    xlrd pytesseract pillow defusedxml

# Claude Code CLI — ПИН версии: без пина rebuild образа тихо тянет свежий CLI (и может сменить
# дефолтную модель/поведение под расчётом смет). Bump версии — осознанное событие + прогон canary.
RUN npm install -g @anthropic-ai/claude-code@2.1.210

# Worker user with same UID as host mcp-user
RUN useradd -m -s /bin/bash -u 1002 worker
USER worker
WORKDIR /data

ENTRYPOINT ["claude"]
