48 lines
1.4 KiB
Docker
48 lines
1.4 KiB
Docker
FROM node:20-alpine AS ui-build
|
|
WORKDIR /ui
|
|
COPY ui/package*.json ./
|
|
RUN npm ci
|
|
COPY ui/ ./
|
|
RUN npm run build && \
|
|
mkdir -p /ui/out && \
|
|
mv dist/src/apps/get-me/index.html /ui/out/get-me.html && \
|
|
mv dist/src/apps/issue-write/index.html /ui/out/issue-write.html && \
|
|
mv dist/src/apps/pr-write/index.html /ui/out/pr-write.html
|
|
|
|
FROM golang:1.25.6-alpine AS build
|
|
ARG VERSION="dev"
|
|
|
|
# Set the working directory
|
|
WORKDIR /build
|
|
|
|
# Install git
|
|
RUN --mount=type=cache,target=/var/cache/apk \
|
|
apk add git
|
|
|
|
# Copy source code (including ui_dist placeholder)
|
|
COPY . .
|
|
|
|
# Copy built UI assets over the placeholder
|
|
COPY --from=ui-build /ui/out/* ./pkg/github/ui_dist/
|
|
|
|
# Build the server
|
|
RUN --mount=type=cache,target=/go/pkg/mod \
|
|
--mount=type=cache,target=/root/.cache/go-build \
|
|
CGO_ENABLED=0 go build -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)" \
|
|
-o /bin/github-mcp-server ./cmd/github-mcp-server
|
|
|
|
# Make a stage to run the app
|
|
FROM gcr.io/distroless/base-debian12
|
|
|
|
# Add required MCP server annotation
|
|
LABEL io.modelcontextprotocol.server.name="io.github.github/github-mcp-server"
|
|
|
|
# Set the working directory
|
|
WORKDIR /server
|
|
# Copy the binary from the build stage
|
|
COPY --from=build /bin/github-mcp-server .
|
|
# Set the entrypoint to the server binary
|
|
ENTRYPOINT ["/server/github-mcp-server"]
|
|
# Default arguments for ENTRYPOINT
|
|
CMD ["stdio"]
|