Skip to content

docs(examples): add dockerized knowledge base example - #69

Merged
david-debest merged 1 commit into
mainfrom
37-docs/dockerized-example
Oct 1, 2026
Merged

david-debest merged 1 commit into
mainfrom
37-docs/dockerized-example

Conversation

@david-debest

Copy link
Copy Markdown
Contributor

Closes #37

Summary

Adds examples/12-dockerized/, showing how to package a knowledge base as a Docker image and run it next to a Smart Connector and Knowledge Directory with Docker Compose.

  • app.py: a minimal ANSWER KB, started with knowledge-mapper run app.py:kb. The CLI unregisters the KB on SIGTERM, so docker stop shuts it down cleanly.
  • asker.py: a one-shot ASK KB, run from the same image, that queries app.py once to show an end-to-end interaction and then exits.
  • Dockerfile: multi-stage build. uv installs the locked dependencies into /opt/venv, and a slim runtime image runs the app as a non-root user. knowledge-mapper is pinned to the PyPI release (0.1.0rc1) through the example's own pyproject.toml/uv.lock, like a real user project would.
  • compose.yaml: Knowledge Directory, Smart Connector, the answer KB and the asker.
  • KB identity and the SC endpoint come from environment variables via KnowledgeBaseSettings (KNOWLEDGE_BASE__ID, KNOWLEDGE_ENGINE_ENDPOINT, …), so the image contains no configuration.
  • README.md, examples/README.md and CONTEXT.md now list the example.

The issue also asked to remove the root Dockerfile. That was already done before this PR (and examples/legacy/ is gone too). The issue suggested the name 10-dockerized, but 10- is taken, so this is 12-.

Testing

  • docker compose up --build: the asker receives both answers and exits 0. The answer KB keeps running.
  • docker compose stop answer-kb: the KB unregisters and exits 0.
  • If the SC is unreachable, knowledge-mapper run exits non-zero, so restart: unless-stopped retries it.
  • ruff check / ruff format --check pass.

Shows how to package a KB as a Docker image and run it next to a Smart
Connector and Knowledge Directory with Docker Compose. KB identity and SC
endpoint come from env vars via KnowledgeBaseSettings, so the image carries
no configuration. A one-shot asker service demonstrates an end-to-end
interaction.

Closes #37

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@david-debest
david-debest merged commit ca93108 into main Oct 1, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add dockerized knowledge base example

1 participant