wedgecheck/Dockerfile
caelum0x 943e696e5b feat: persist completed briefs, add shareable permalinks + session history
Every brief used to be generated and handed straight back in the response
-- closing the tab (or losing the API response) lost it for good, and
there was no way to send someone a link to a result.

- app/store.py: SQLite persistence (stdlib sqlite3, no new dependency).
- GET /b/{id}: a public-by-id shareable permalink for one completed
  report. /api/brief now returns id + permalink_url too.
- GET /history: a browser's own past briefs via an anonymous session
  cookie (wedgecheck_session) -- no user-account system, just a grouping
  key, consistent with the rest of Wedgecheck's no-auth design.
- DB writes/reads run via asyncio.to_thread, same pattern as the existing
  event-loop-blocking fix in brief.py (this app is single uvicorn worker,
  so any sync blocking call freezes every concurrent request).

Verified live against the real deployed code path (local uvicorn, free
ai-relay LLM + duckduckgo retriever, no mocks): POST /api/brief returned a
real id/permalink_url, the row landed in sqlite with the real report
content, GET /b/{id} rendered it (and 404s for an unknown id), and
GET /history correctly scoped a session's own briefs (verified both the
empty state and, after seeding a second row under the same session
cookie, that it lists + links to the right permalink). The free
duckduckgo retriever's documented flakiness (0 sources on some attempts)
is pre-existing and unrelated -- unaffected by this change, confirmed the
web-form error path still shows the error and correctly skips persisting
a failed brief.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-29 07:12:06 +03:00

36 lines
1.3 KiB
Docker

# Wedgecheck: FastAPI app on top of gpt-researcher (Apache-2.0).
#
# No torch/sentence-transformers here on purpose -- production points
# EMBEDDING at "custom:bge" (this portfolio's free Cloudflare Workers AI
# relay's /v1/embeddings route) instead of local HuggingFace embeddings, so
# the image stays small and fast to build on the arm64 Oracle box.
FROM python:3.12-slim
WORKDIR /app
RUN apt-get update && apt-get install -y --no-install-recommends \
curl \
&& rm -rf /var/lib/apt/lists/*
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY app ./app
COPY web ./web
COPY cli.py ./cli.py
# Writable at runtime for cli.py's ./output/ (the web app itself doesn't
# need it, but keep the dir present and writable either way) and for
# app/store.py's SQLite DB (./data/wedgecheck.db by default -- WEDGECHECK_DB_PATH
# to relocate it). Mount a volume at /app/data in production or saved
# briefs/permalinks won't survive a container recreate.
RUN mkdir -p /app/output /app/data && useradd -u 10001 -m wedgecheck \
&& chown -R wedgecheck:wedgecheck /app
USER wedgecheck
EXPOSE 8000
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
CMD curl -fsS http://127.0.0.1:8000/healthz || exit 1
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]