- OCR pipeline: Tesseract (images) + pdfplumber (PDFs) → AI text prompt → rule-based regex fallback; works with any text model, not just vision models - Scan Receipt toolbar button parses a photo and pre-fills the transaction form; receipt image is automatically attached to the created transaction - AI settings page: provider, API key (AES-256-GCM encrypted), custom URL, model, and per-user debug toggle that gates the OCR/AI debug panel - Fix CSRF cookie secure=False so HTTP deployments work; add 7-day max_age - Fix attachment_refs missing from _to_response (attachments never appeared in UI) - Fix multipart boundary lost when Content-Type was set manually in axios calls - nginx: raise client_max_body_size to 15 MB, add 120s proxy timeout for OCR - Migration 0005: add ai_debug boolean to users table - Update README and CLAUDE.md with AI scanning docs and architecture notes Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
32 lines
924 B
Docker
32 lines
924 B
Docker
FROM python:3.12-slim AS base
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
libmagic1 \
|
|
postgresql-client \
|
|
gnupg \
|
|
gzip \
|
|
gosu \
|
|
tesseract-ocr \
|
|
tesseract-ocr-eng \
|
|
poppler-utils \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
RUN pip install --no-cache-dir uv
|
|
WORKDIR /app
|
|
COPY pyproject.toml ./
|
|
|
|
FROM base AS deps
|
|
RUN uv pip install --system --no-cache -e .
|
|
|
|
FROM deps AS production
|
|
COPY app/ ./app/
|
|
COPY alembic/ ./alembic/
|
|
COPY alembic.ini ./
|
|
COPY scripts/ ./scripts/
|
|
RUN useradd -r -s /bin/false -u 1001 appuser \
|
|
&& chown -R appuser /app \
|
|
&& mkdir -p /app/uploads /app/backups \
|
|
&& chown appuser /app/uploads /app/backups
|
|
COPY scripts/entrypoint.sh /entrypoint.sh
|
|
RUN chmod +x /entrypoint.sh
|
|
EXPOSE 8000
|
|
ENTRYPOINT ["/entrypoint.sh"]
|
|
CMD ["sh", "-c", "python -m alembic upgrade head && uvicorn app.main:app --host 0.0.0.0 --port 8000 --workers 2 --proxy-headers"]
|