Files
Juan Antonio Osorio 63d3d8c60e fix: use ENTRYPOINT and CMD for proper argument handling (#454)
* fix: use ENTRYPOINT and CMD for proper argument handling

- Change from CMD to ENTRYPOINT + CMD pattern for better Docker practices
- ENTRYPOINT sets the executable that always runs
- CMD provides default arguments that can be overridden
- This allows container runtimes to properly append additional arguments
- Fixes issues with argument passing in container orchestration tools

Before: CMD ["./github-mcp-server", "stdio"]
After: ENTRYPOINT ["./github-mcp-server"] + CMD ["stdio"]

* address review feedback: use absolute path and improve comments
2025-06-03 00:19:59 +02:00

29 lines
944 B
Docker

FROM golang:1.24.3-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
# Build the server
# go build automatically download required module dependencies to /go/pkg/mod
RUN --mount=type=cache,target=/go/pkg/mod \
--mount=type=cache,target=/root/.cache/go-build \
--mount=type=bind,target=. \
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/main.go
# Make a stage to run the app
FROM gcr.io/distroless/base-debian12
# 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"]