# Generated by https://smithery.ai. See: https://smithery.ai/docs/config#dockerfile
# Start with the official Golang image to use Go tools
FROM golang:1.20-alpine AS builder
# Set the working directory
WORKDIR /app
# Copy the Go mod and sum files for dependency installation
COPY go.mod go.sum ./
# Download the dependencies
RUN go mod download
# Copy the entire source code
COPY . .
# Build the Go application
RUN go build -o mcp-k8s-go main.go
# Use a minimal base image for the final binary
FROM alpine:latest
# Set the working directory
WORKDIR /app
# Copy the compiled binary from the builder
COPY --from=builder /app/mcp-k8s-go .
# Set the KUBECONFIG environment variable to the default path (can be overridden)
ENV KUBECONFIG=/root/.kube/config
# Command to run the binary
ENTRYPOINT ["/app/mcp-k8s-go"]