- 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>
24 lines
833 B
Docker
24 lines
833 B
Docker
FROM python:3.13-slim AS base
|
|
|
|
WORKDIR /app
|
|
|
|
COPY pyproject.toml README.md ./
|
|
COPY src/ src/
|
|
|
|
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
|
|
|
|
EXPOSE 5000
|
|
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()'"]
|