Files
accounts/Dockerfile
T
jimmyandClaude Opus 5.5 9b9203c4bb Make Docker Compose setup production-ready
- Require a login: HTTP Basic auth from CASHBOOK_PASSWORD (compose
  refuses to start without it); /healthz stays open for health checks
- Run as non-root (1000:1000 by default, CASHBOOK_USER to override)
  with a read-only filesystem, tmpfs /tmp, no capabilities,
  no-new-privileges, and CPU/memory/pid limits
- Health check, log rotation, configurable bind address and port
- Refuse cross-origin POSTs by matching Origin to Host (works behind a
  reverse proxy), cap request size, add security headers, and stop
  leaking exception text in 500 responses
- Make the extra statements mount opt-in; create the data folder at
  startup; document server setup and reverse proxying in the README

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 17:25:45 +13:00

27 lines
982 B
Docker

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; /tmp is the only writable place besides /data
ENV HOME=/tmp \
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=20s --retries=3 \
CMD ["python3", "-c", "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8765/healthz', timeout=3)"]
# /data holds the cashbooks and statements/;
# /statements can hold a read-only folder of ANZ exports
CMD ["python3", "src/webapp.py", "--host", "0.0.0.0", "--data", "/data", "--statements", "/statements"]