Skip to content

Commit 2e4a6a7

Browse files
Copilotphrocker
andauthored
Fix github-mcp-server Dockerfile: Use Go build instead of Node.js (#61)
* Initial plan * Fix MCP server Dockerfile to use Go instead of Node.js - Changed base image from node:20-alpine to golang:latest - Removed incorrect npm install and build commands - Added proper Go build process matching upstream repository - Added SSL bypass workarounds for restricted build environments - Repository is Go-based, not Node.js based Co-authored-by: phrocker <[email protected]> * Remove insecure SSL bypass settings for production safety Removed git config http.sslVerify false and GOPROXY=direct workarounds. These were only needed for restricted build environments and pose security risks in production. The core fix (Go instead of Node.js) works without them. Co-authored-by: phrocker <[email protected]> * commit --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: phrocker <[email protected]> Co-authored-by: Marc Parisi <[email protected]>
1 parent b1eadf0 commit 2e4a6a7

File tree

2 files changed

+31
-13
lines changed

2 files changed

+31
-13
lines changed

api/src/main/resources/db/migration/V32__create_self_healing_tables.sql renamed to api/src/main/resources/db/migration/V33__create_self_healing_tables.sql

File renamed without changes.
Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,40 @@
11
# GitHub MCP Server Docker Image
2-
FROM node:20-alpine
2+
# This builds the github-mcp-server from source using Go
3+
FROM golang:latest AS build
4+
ARG VERSION="dev"
35

4-
# Install git (required for repository operations)
5-
RUN apk add --no-cache git
6+
# Set the working directory
7+
WORKDIR /build
68

7-
# Create app directory
8-
WORKDIR /app
9+
# Clone the github-mcp-server repository
10+
RUN git clone https://github.com/github/github-mcp-server.git .
911

10-
# Clone and build the github-mcp-server
11-
RUN git clone https://github.com/github/github-mcp-server.git . && \
12-
npm install && \
13-
npm run build
12+
# Download all dependencies
13+
RUN go mod download
1414

15-
# Expose the port for MCP server (using stdio by default, but we'll add HTTP support)
16-
EXPOSE 3000
15+
# Build the server binary
16+
RUN CGO_ENABLED=0 go build \
17+
-ldflags="-s -w -X main.version=${VERSION} -X main.commit=$(git rev-parse HEAD) -X main.date=$(date -u +%Y-%m-%dT%H:%M:%SZ)" \
18+
-o /bin/github-mcp-server \
19+
cmd/github-mcp-server/main.go
20+
21+
# Runtime stage - use minimal distroless image
22+
FROM gcr.io/distroless/base-debian12
23+
24+
# Add required MCP server annotation
25+
LABEL io.modelcontextprotocol.server.name="io.github.github/github-mcp-server"
26+
27+
# Set the working directory
28+
WORKDIR /server
29+
30+
# Copy the binary from the build stage
31+
COPY --from=build /bin/github-mcp-server .
1732

1833
# Environment variables for GitHub token will be passed at runtime
1934
ENV GITHUB_PERSONAL_ACCESS_TOKEN=""
2035

21-
# Run the MCP server
22-
CMD ["node", "dist/index.js"]
36+
# Set the entrypoint to the server binary
37+
ENTRYPOINT ["/server/github-mcp-server"]
38+
39+
# Default arguments for ENTRYPOINT (stdio mode)
40+
CMD ["stdio"]

0 commit comments

Comments
 (0)