fix(docs-mcp): install git in Dockerfile builder stage for lefthook prepare#471
Merged
Merged
Conversation
…repare `pnpm install --frozen-lockfile` runs the root workspace's `prepare` script (`lefthook install`), which shells out to `git` — but node:24-slim doesn't ship it, and the build context intentionally omits `.git`. Add git plus a throwaway `git init`, both discarded with the builder stage. Verified locally: `docker build` succeeds and a real `search_docs` call over stdio returns correct, on-topic results. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.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.
Why
Testing
packages/docs-mcp/Dockerfilelocally (the spec Glama's Docker build step is meant to use — see #469) surfaced a real build failure:docker build -f packages/docs-mcp/Dockerfile -t mcp-server .failed withexec: "git": executable file not found in $PATH.Root cause
pnpm install --frozen-lockfilein the builder stage triggers the root workspace'spreparescript (lefthook install), which shells out togit.node:24-slimdoesn't shipgit, and the build context intentionally omits.git(it's not in the COPY list, and shouldn't be — no reason to ship repo history into a build context). So even after installinggit,lefthook installstill failed withfatal: not a git repository.Fix
Install
gitand run a throwawaygit initin the builder stage, right aftercorepack enable. Both are discarded along with the rest of that stage — nothing here reaches the runtime image.Test plan
docker build -f packages/docs-mcp/Dockerfile -t mcp-server .succeeds end-to-end (full pnpm workspace install + apps/docs bundle pipeline + tsup build)docker run -i --rm -e MCP_PROXY_DEBUG=true mcp-serverpiped a realinitialize→tools/list→tools/call search_docssequence over stdio and got back correct, on-topic hybrid-search results (Throttle, Retry & backoff, RateLimitError docs), confirming the embedding model and search index work at runtime inside the container — not just that the image builds🤖 Generated with Claude Code