Files
LarsandClaude Opus 5.5 6cdad8b046 Run the containers with the systemd configuration, 1:1
The containers now read the unchanged .env of the matching systemd instance
(/home/llmadmin/mindnet_dev/.env, /home/llmadmin/mindnet/.env) and use the
same Qdrant, Ollama, vault and collection prefix, so both can be compared
side by side. Only container-specific values are overridden: host service
addresses (host.docker.internal instead of 127.0.0.1) and the read-only vault.

- deploy/appenv.py derives the vault mount and prefix from that .env and
  rejects application keys in the container-only file.
- Remove the separate dev Qdrant, the synthetic test vault and the import step.
- UI binds 0.0.0.0 like systemd; API stays loopback by default.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 17:22:08 +01:00

67 lines
2.5 KiB
Docker

# 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/
COPY .dockerignore ./
COPY .gitea/workflows/ .gitea/workflows/
USER mindnet:mindnet
ENTRYPOINT []
CMD ["python", "-m", "pytest", "-q", "-p", "no:cacheprovider", \
"tests/test_container_preflight.py", "tests/test_container_connectivity.py", \
"tests/test_container_appenv.py"]