fix(mcp): use dumb-init as PID 1 to reap zombie processes

MCP containers spawning child processes (npx, uvx, etc.) left zombies
because the Go binary running as PID 1 does not reap orphaned children.
Add dumb-init as the entrypoint init process.
This commit is contained in:
Menci
2026-03-08 01:45:17 +08:00
committed by 晨苒
parent 71545dd606
commit 8ce5243eb3
+2 -2
View File
@@ -24,7 +24,7 @@ RUN --mount=type=cache,target=/go/pkg/mod \
FROM alpine:latest
# Base utilities
RUN apk add --no-cache grep curl bash
RUN apk add --no-cache grep curl bash dumb-init
# Node.js + npm (provides npx for JS/TS MCP servers)
RUN apk add --no-cache nodejs npm
@@ -40,4 +40,4 @@ COPY --from=build /out/mcp /opt/mcp
COPY cmd/mcp/template /opt/mcp-template
COPY cmd/mcp/entrypoint.sh /opt/entrypoint.sh
RUN chmod +x /opt/entrypoint.sh
ENTRYPOINT ["/opt/entrypoint.sh"]
ENTRYPOINT ["/usr/bin/dumb-init", "--", "/opt/entrypoint.sh"]