feat: add Docker support with ghcr.io publish workflow#66
Open
Eli-Golin wants to merge 2 commits intococoindex-io:mainfrom
Open
feat: add Docker support with ghcr.io publish workflow#66Eli-Golin wants to merge 2 commits intococoindex-io:mainfrom
Eli-Golin wants to merge 2 commits intococoindex-io:mainfrom
Conversation
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.
Add Docker support
What this PR adds
docker/Dockerfile— multi-stage build that produces a self-contained image.github/workflows/docker-publish.yml— publishes toghcr.io/cocoindex-io/cocoindex-codeon every release taguvx/claude mcp addinstructionsMotivation
Some teams can't or don't want to install Python,
uv, or manage systemdependencies on developer machines. Docker gives them:
Design decisions
Multi-stage build
Three stages keep the final image lean and cache-friendly:
builder— installs cocoindex-code and sentence-transformers viauvmodel_cache— pre-bakesall-MiniLM-L6-v2into the image so coldstarts don't trigger a ~90 MB download
runtime— copies packages + model from previous stages into a freshpython:3.12-slimbasepython:3.12-slim, not Alpinecocoindex ships pre-built Rust wheels linked against glibc. Alpine uses musl-libc
and would require building from source.
ENTRYPOINT ["cocoindex-code", "serve"]serveis the MCP stdio subcommand. This keeps the container invocation clean(
docker run --rm -i ... image) with no extra arguments needed. Users who wantthe one-shot indexer can override with
--entrypoint cocoindex-code ... index.All config via environment variables
No project-specific defaults are baked into the image.
COCOINDEX_CODE_ROOT_PATHdefaults to
/workspace(the conventional mount point), everything else isleft to the user's
docker run -eflags or.mcp.jsonconfig.Named volume for model cache
The default model is baked in, but users who override
COCOINDEX_CODE_EMBEDDING_MODELwith an external provider benefit from a named volume so the model is only
downloaded once across rebuilds:
First-time setup note
After the workflow runs for the first time, the
ghcr.io/cocoindex-io/cocoindex-codepackage will be created automatically but will be private by default.
A maintainer needs to set it to public once:
After that,
docker pull ghcr.io/cocoindex-io/cocoindex-code:latestworks foreveryone without authentication.
Testing
Tested locally against a Scala/SBT codebase:
docker build -t cocoindex-code:local -f docker/Dockerfile .— builds cleanlyinitialize→ valid JSON-RPCresult) ✅tools/listreturnssearchtool ✅.cocoindex_code/index directory created in mounted workspace ✅.mcp.json— semantic search returns results ✅