Files
Keysat b470ea2659 Containerize the Matrix intake bot as a managed service (restart: unless-stopped)
Turn the bot from a bare nohup process (silently dies on a Spark reboot) into a docker-compose service. Dockerfile bundles backend/matrix_intake + the stdlib backend/ingest Spark client it reuses; .env is mounted read-only at runtime, never baked. The existing repo-root .dockerignore (shared with the s9pk build) already keeps data/ and .env out of context. Also adds a handoff doc for wiring a spark-control dashboard card in a later session.
2026-06-17 20:10:16 -05:00

23 lines
1.2 KiB
Docker

# 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"]