# Custom Paperless-ngx with German OCR support
FROM ghcr.io/paperless-ngx/paperless-ngx:latest

# Switch to root to install packages
USER root

# Update package list and install German OCR language data
# The correct package name is tesseract-ocr-deu (not tesseract-data-deu)
RUN apt-get update && \
    apt-get install -y \
    tesseract-ocr-deu \
    && apt-get clean && \
    rm -rf /var/lib/apt/lists/*

# Verify German language pack is installed
RUN tesseract --list-langs | grep deu || echo "German language pack not found"

# Switch back to paperless user
USER paperless

# Set the OCR language to include German and English
ENV PAPERLESS_OCR_LANGUAGE=deu+eng