# Container image for the Matrix intake bot — turns it from a bare nohup process into a managed # service (docker compose `restart: unless-stopped` survives a Spark reboot). # # Build context is the REPO ROOT (see ../../docker-compose.yml), not this directory: the bot is # NOT self-contained — spark.py reaches into backend/ingest/{llm,config,http_util}.py (stdlib # only) via sys.path, so the image must carry both trees with the repo layout preserved. That # keeps settings.load_env's REPO_ROOT (three dirs up from settings.py) = /app and spark.py's # ingest path = /app/backend/ingest both correct at runtime. FROM python:3.12-slim WORKDIR /app # The only third-party dep is matrix-nio; the reused ingest Spark client is pure stdlib. COPY backend/matrix_intake/requirements.txt ./requirements.txt RUN pip install --no-cache-dir -r requirements.txt COPY backend/matrix_intake/ ./backend/matrix_intake/ COPY backend/ingest/ ./backend/ingest/ # .env (Matrix + CRM + Spark creds) is mounted read-only at /app/.env at runtime — never baked. # `-u` keeps stdout/stderr unbuffered so `docker logs` shows the bot's lifecycle lines live. CMD ["python", "-u", "backend/matrix_intake/bot.py"]