Containerized deployment of the MultiMind gateway API.
The image is a multi-stage build on python:3.11-slim: the builder stage wheels the package, the runtime stage installs only the wheel plus the gateway extra (FastAPI, uvicorn). No torch, docs, tests, or examples are included. Final size is roughly 300 MB.
docker build -t multimind-sdk:latest .Optional: bake extra dependency groups into the image (see pyproject.toml for available extras):
docker build --build-arg MULTIMIND_EXTRAS=gateway,rag -t multimind-sdk:rag .docker run -d --name multimind -p 8000:8000 \
-e OPENAI_API_KEY=... \
-e ANTHROPIC_API_KEY=... \
multimind-sdk:latestAll provider keys are optional; set only the ones you use: OPENAI_API_KEY, ANTHROPIC_API_KEY, GROQ_API_KEY, MISTRAL_API_KEY, GEMINI_API_KEY, DEEPSEEK_API_KEY, HUGGINGFACE_API_KEY. Other settings: DEFAULT_MODEL (default openai), OLLAMA_API_BASE, OLLAMA_MODEL_NAME, LOG_LEVEL, MULTIMIND_PORT (default 8000).
Or pass an env file instead of individual -e flags:
docker run -d --name multimind -p 8000:8000 --env-file .env multimind-sdk:latestThe gateway reads a .env file at the repo root automatically (optional).
docker compose up -d # gateway only
docker compose --profile local up -d # gateway + ollama (local models)
docker compose --profile vector-store up -d # gateway + chromaDEFAULT_MODEL=ollama docker compose --profile local up -d
docker compose exec ollama ollama pull mistral
curl -X POST http://localhost:8000/v1/chat \
-H 'Content-Type: application/json' \
-d '{"model": "ollama", "messages": [{"role": "user", "content": "Hello"}]}'The gateway is preconfigured with OLLAMA_API_BASE=http://ollama:11434, so the two containers talk over the compose network. Ollama models persist in the ollama_models volume.
GET /health— liveness (no auth, no provider keys needed). Used by the imageHEALTHCHECKand the compose healthcheck.GET /ready— readiness probe.
curl http://localhost:8000/health
docker inspect --format '{{.State.Health.Status}}' multimindThe healthcheck uses Python's urllib, so no curl is required inside the image.
docker run --rm -it --env-file .env multimind-sdk:latest multimind chatThe CLI works torch-free: only the convert command needs torch, and it fails with a clear
install hint in the lean image. For model conversion inside a container, build with the
finetune extra (large image, several GB):
docker build --build-arg MULTIMIND_EXTRAS=gateway,finetune -t multimind-sdk:cli .
docker run --rm -it --env-file .env multimind-sdk:cli multimind convert --help-
The container runs as non-root user
multimind(uid 10001). -
Read-only root filesystem is supported. Chat sessions are written under
/app, so mount it as a tmpfs owned by the app user:docker run -d --read-only --tmpfs /app:uid=10001,gid=10001 \ -p 8000:8000 --env-file .env multimind-sdk:latest
-
Set resource limits, e.g.
docker run --memory 1g --cpus 2 ..., or in compose:services: gateway: deploy: resources: limits: memory: 1g cpus: "2"
-
Never bake secrets into the image;
.envis excluded by.dockerignore. Inject keys at runtime via env vars or your orchestrator's secret store. -
Restrict CORS in production with
MULTIMIND_ALLOWED_ORIGINS(comma-separated); the default allows localhost only. -
Chat sessions in compose persist in the
multimind_sessionsvolume; drop the volume mount if you want stateless containers.