FROM debian:bookworm-slim

# LibreOffice (headless Calc) + its Python bridge, and pdftotext for PDF statements
RUN apt-get update \
    && apt-get install -y --no-install-recommends \
        python3 python3-uno libreoffice-calc-nogui poppler-utils fonts-dejavu-core \
    && rm -rf /var/lib/apt/lists/*

WORKDIR /app
COPY src ./src

# LibreOffice needs a writable home; the container may run as any user
ENV HOME=/tmp
EXPOSE 8765

# /data holds the cashbooks and statements/;
# /statements holds ANZ statement folders mounted read-only
CMD ["python3", "src/webapp.py", "--host", "0.0.0.0", "--data", "/data", "--statements", "/statements"]
