# Build stage
FROM cgr.dev/chainguard/go:latest AS builder
WORKDIR /app
# Copy go.mod and go.sum first to leverage Docker cache
COPY go.mod go.sum ./
RUN go mod download
# Copy the rest of the source code
COPY . .
# Build the binary
RUN CGO_ENABLED=0 go build -o buildkite-mcp-server ./cmd/buildkite-mcp-server/main.go
# Final stage
FROM cgr.dev/chainguard/static:latest
WORKDIR /app
# Copy the binary from the builder stage
COPY --from=builder /app/buildkite-mcp-server /app/buildkite-mcp-server
# Set the entrypoint to run the server in stdio mode
ENTRYPOINT ["/app/buildkite-mcp-server", "stdio"]