Prepare containerized dev/prod deployment (inactive)
Add a Docker image and separate Compose projects for development and production, based on the stable main behaviour without the privacy gateway. Nothing is wired into the existing systemd deploy workflow. - One non-root image (api | ui | preflight), base image pinned by digest, dependencies from a hash-locked universal lock without torch and sentence-transformers (MiniLM is not on the runtime path) - Preflight aborts on: VECTOR_DIM != 768 or non-nomic embedding profile, implicit or cross-env collection prefix, cloud keys without explicit egress acknowledgement, missing/empty or writable vault mount - Vault is a read-only NAS bind mount without host-path autocreation; healthcheck turns unhealthy when the vault sentinel disappears - Dev runs its own Qdrant; prod reuses the existing host instance - API published on loopback only; read-only rootfs, cap_drop ALL, no-new-privileges - Dev workflow kept as an inactive template outside .gitea/workflows - Docs: operations guide and migration plan with release gates, test baseline classification, R2/R3 and privacy gateway requirements Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
0d61a9e191
commit
7a225ba2b6
18 files changed
+2864
No files matched your search
@@ -0,0 +1,62 @@
|
||||
# syntax=docker/dockerfile:1.7
|
||||
#
|
||||
# Mindnet-Image für API und Streamlit-UI (ein Image, Modus per CMD: api | ui | preflight).
|
||||
# Build-Kontext ist das Repository-Root; die Allowlist steht in /.dockerignore.
|
||||
#
|
||||
# docker build -f deploy/Dockerfile -t mindnet:<git-sha> .
|
||||
#
|
||||
# Reproduzierbarkeit: Basis-Image per Digest, Abhängigkeiten per Hash-Lock
|
||||
# (deploy/requirements.lock). Kein torch / sentence-transformers: Embeddings
|
||||
# kommen ausschließlich von Ollama (nomic-embed-text, 768 Dimensionen).
|
||||
|
||||
ARG PYTHON_IMAGE=python:3.12-slim-bookworm@sha256:e697c81897302a4c4333bade000d98038fbb21eb064f8ee1fd42d02ebcd9d337
|
||||
|
||||
# --- Abhängigkeiten in ein isoliertes venv -----------------------------------
|
||||
FROM ${PYTHON_IMAGE} AS deps
|
||||
ENV PIP_NO_CACHE_DIR=1 \
|
||||
PIP_DISABLE_PIP_VERSION_CHECK=1 \
|
||||
PYTHONDONTWRITEBYTECODE=1
|
||||
COPY deploy/requirements.lock /tmp/requirements.lock
|
||||
RUN python -m venv /opt/venv \
|
||||
&& /opt/venv/bin/pip install --require-hashes --no-deps -r /tmp/requirements.lock
|
||||
|
||||
# --- Laufzeit-Image -------------------------------------------------------------
|
||||
FROM ${PYTHON_IMAGE} AS runtime
|
||||
ARG MINDNET_UID=10001
|
||||
ENV PATH=/opt/venv/bin:${PATH} \
|
||||
PYTHONDONTWRITEBYTECODE=1 \
|
||||
PYTHONUNBUFFERED=1 \
|
||||
PYTHONPATH=/app \
|
||||
HOME=/tmp \
|
||||
STREAMLIT_BROWSER_GATHER_USAGE_STATS=false
|
||||
|
||||
RUN groupadd --system --gid ${MINDNET_UID} mindnet \
|
||||
&& useradd --system --uid ${MINDNET_UID} --gid mindnet --no-create-home --shell /usr/sbin/nologin mindnet
|
||||
|
||||
COPY --from=deps /opt/venv /opt/venv
|
||||
|
||||
WORKDIR /app
|
||||
# Code und Konfiguration gehören root und sind für den Laufzeitnutzer nur lesbar.
|
||||
COPY app/ app/
|
||||
COPY config/ config/
|
||||
COPY scripts/ scripts/
|
||||
COPY deploy/entrypoint.py deploy/healthcheck.py /opt/mindnet/
|
||||
|
||||
# Einzige beschreibbare Pfade (als Volumes gemountet): Logs und Laufzeitdaten.
|
||||
RUN install -d -o mindnet -g mindnet -m 0750 /app/logs /app/data /app/data/logs
|
||||
|
||||
USER mindnet:mindnet
|
||||
EXPOSE 8000 8501
|
||||
ENTRYPOINT ["python", "/opt/mindnet/entrypoint.py"]
|
||||
CMD ["api"]
|
||||
|
||||
# --- Test-Image (nur für nichtproduktive Läufe) ---------------------------------
|
||||
FROM runtime AS test
|
||||
USER root
|
||||
COPY deploy/requirements-test.lock /tmp/requirements-test.lock
|
||||
RUN pip install --no-cache-dir --require-hashes --no-deps -r /tmp/requirements-test.lock
|
||||
COPY tests/ tests/
|
||||
COPY deploy/ deploy/
|
||||
USER mindnet:mindnet
|
||||
ENTRYPOINT []
|
||||
CMD ["python", "-m", "pytest", "-q", "-p", "no:cacheprovider", "tests/test_container_preflight.py"]
|
||||
Reference in new issue
Block a user