Files
jimmyandClaude Opus 5.5 708ce8352e Add receipts, suppliers and a top navigation bar
Receipts and invoices: attach photos and PDFs to transactions, read the
supplier, date, total, GST and line items with Tesseract OCR, and match
them to bank transactions by amount and date. Receipts can have several
pages, and hand corrections survive re-reading.

Suppliers: saved suppliers that uploads are linked to by GST number or
name.

The sections (cashbook, receipts, invoices, customers, suppliers,
mileage, statements) move to a top bar, with the book controls in a row
beneath it, and the layout works on phones.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 19:05:44 +13:00

42 lines
1.6 KiB
Docker

FROM debian:bookworm-slim
# LibreOffice (headless Calc) + its Python bridge for spreadsheet export,
# pdftotext for PDF statements, tesseract + Pillow to read receipt photos
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
python3 python3-venv python3-uno libreoffice-calc-nogui poppler-utils fonts-dejavu-core \
tesseract-ocr tesseract-ocr-eng python3-pil \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# a venv that can still see the system python3-uno
COPY Pipfile Pipfile.lock ./
RUN python3 -m venv --system-site-packages /opt/venv \
&& /opt/venv/bin/pip install --no-cache-dir pipenv \
&& /opt/venv/bin/pipenv requirements > /tmp/requirements.txt \
&& /opt/venv/bin/pip install --no-cache-dir -r /tmp/requirements.txt \
&& /opt/venv/bin/pip uninstall -y pipenv \
&& rm /tmp/requirements.txt
COPY src ./src
# LibreOffice needs a writable home; /tmp is the only writable place besides /data
ENV PATH=/opt/venv/bin:$PATH \
HOME=/tmp \
CASHBOOK_DATA=/data \
CASHBOOK_STATEMENTS=/statements \
PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1
# run unprivileged by default (compose can override with `user:`)
USER 1000:1000
EXPOSE 8765
HEALTHCHECK --interval=30s --timeout=5s --start-period=30s --retries=3 \
CMD ["python", "-c", "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8765/healthz', timeout=3)"]
# --proxy-headers: trust X-Forwarded-Proto from the hosts in FORWARDED_ALLOW_IPS
# (so cookies are marked Secure behind an HTTPS proxy)
CMD ["uvicorn", "app:app", "--app-dir", "src", "--host", "0.0.0.0", "--port", "8765", "--proxy-headers"]