# =============================================================================
# Dockerfile — service OCRmyPDF (L'IA du juriste V2.1)
# Wrapper HTTP local autour d'OCRmyPDF + Tesseract (français + anglais).
# Aucun appel extérieur. Exposition uniquement sur 127.0.0.1:8000.
# =============================================================================

FROM jbarlow83/ocrmypdf-alpine:latest

# OCRmyPDF + Tesseract sont déjà présents dans l'image de base ; on ajoute
# le pack de langue française (au cas où l'image minimale ne l'embarque pas
# encore — l'image récente de jbarlow83 inclut déjà fra/eng/deu/spa).
USER root
RUN apk add --no-cache \
        py3-pip \
        tesseract-ocr-data-fra \
        tesseract-ocr-data-eng \
    && pip3 install --no-cache-dir --break-system-packages \
        "flask==3.0.*" \
        "ocrmypdf>=16.0,<18"

WORKDIR /srv
COPY server.py /srv/server.py

EXPOSE 8000
ENTRYPOINT []
CMD ["python3", "/srv/server.py"]
