Skip to content

fix(docs-mcp): install git in Dockerfile builder stage for lefthook prepare#471

Merged
rejifald merged 1 commit into
mainfrom
claude/mcp-dockerfile-config-800364
Jul 8, 2026
Merged

fix(docs-mcp): install git in Dockerfile builder stage for lefthook prepare#471
rejifald merged 1 commit into
mainfrom
claude/mcp-dockerfile-config-800364

Conversation

@rejifald

@rejifald rejifald commented Jul 8, 2026

Copy link
Copy Markdown
Owner

Why

Testing packages/docs-mcp/Dockerfile locally (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 with exec: "git": executable file not found in $PATH.

Root cause

pnpm install --frozen-lockfile in the builder stage triggers the root workspace's prepare script (lefthook install), which shells out to git. node:24-slim doesn't ship git, 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 installing git, lefthook install still failed with fatal: not a git repository.

Fix

Install git and run a throwaway git init in the builder stage, right after corepack 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-server piped a real initializetools/listtools/call search_docs sequence 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

…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>
@rejifald rejifald merged commit 9f666c3 into main Jul 8, 2026
12 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.

1 participant