docs(examples): add dockerized knowledge base example - #69
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 withknowledge-mapper run app.py:kb. The CLI unregisters the KB on SIGTERM, sodocker stopshuts it down cleanly.asker.py: a one-shot ASK KB, run from the same image, that queriesapp.pyonce 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-mapperis pinned to the PyPI release (0.1.0rc1) through the example's ownpyproject.toml/uv.lock, like a real user project would.compose.yaml: Knowledge Directory, Smart Connector, the answer KB and the asker.KnowledgeBaseSettings(KNOWLEDGE_BASE__ID,KNOWLEDGE_ENGINE_ENDPOINT, …), so the image contains no configuration.README.md,examples/README.mdandCONTEXT.mdnow list the example.The issue also asked to remove the root
Dockerfile. That was already done before this PR (andexamples/legacy/is gone too). The issue suggested the name10-dockerized, but10-is taken, so this is12-.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.knowledge-mapper runexits non-zero, sorestart: unless-stoppedretries it.ruff check/ruff format --checkpass.