public-release phases 1-3: read-only public mode, gunicorn container, demo bootstrap, CI, README

- before_request guard: visitors browse + explore; writes need PHYSCOM_ADMIN_TOKEN login
- SameSite=Lax/HttpOnly cookies, persisted secret key, debug off unless FLASK_DEBUG=1
- non-root gunicorn container with healthcheck; physcom demo --if-empty on first start
- landing page Top Concepts, write controls hidden from visitors
- CI workflow, pyproject metadata, compose Ollama parity, README rewrite
- tests/test_web_access.py: access control + GET smoke test of every page

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2026-09-25 15:40:02 -05:00
parent 2e38a6cf73
commit 8171fc023e
23 changed files with 510 additions and 112 deletions

View File

@@ -2,14 +2,22 @@ FROM python:3.13-slim AS base
WORKDIR /app
COPY pyproject.toml .
COPY pyproject.toml README.md ./
COPY src/ src/
RUN pip install --no-cache-dir ".[web,gemini]"
RUN pip install --no-cache-dir ".[web,gemini]" \
&& useradd --create-home --uid 1000 physcom \
&& mkdir -p /app/data && chown physcom:physcom /app/data
USER physcom
VOLUME /app/data
ENV PHYSCOM_DB=/app/data/physcom.db
ENV HOST=0.0.0.0
EXPOSE 5000
CMD ["python", "-m", "physcom_web"]
HEALTHCHECK --interval=30s --timeout=5s --start-period=60s \
CMD python -c "import urllib.request; urllib.request.urlopen('http://127.0.0.1:5000/', timeout=4)"
# First start on an empty volume builds the demo data (~20s: seed + passes
# 1-3 for every domain). One gunicorn worker: pipeline runs are background
# threads inside the web process.
CMD ["sh", "-c", "physcom demo --if-empty && exec gunicorn --workers 1 --threads 8 --timeout 120 --bind 0.0.0.0:5000 'physcom_web.app:create_app()'"]