1- # --- Stage 1: Build the binary from source (Latest Nightly) ---
2- FROM golang:1.25 AS builder
1+ # --- Final Runtime Image ---
2+ # Using python:3.11 as the base image to support evaluations that require Python,
3+ # while still running the pre-compiled Go binary for the toolbox server.
4+ FROM python:3.11
35
4- WORKDIR /build
5-
6- # Clone the official genai-toolbox source code (always latest main branch)
7- RUN git clone --depth 1 https://github.com/googleapis/genai-toolbox.git .
8-
9- # Compile the binary with CGO ENABLED to support all upstream database drivers (Oracle, etc.)
10- RUN CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -o toolbox .
11-
12- # --- Stage 2: Final Lightweight Runtime Image ---
13- # Using the exact same image (golang:1.25) for runtime to perfectly match GLIBC versions
14- FROM golang:1.25
15-
16-
17- # Install necessary runtime certificates and standard C libraries for CGO binary
18- RUN apt-get update && apt-get install -y ca-certificates libc6 && rm -rf /var/lib/apt/lists/*
6+ # Install necessary runtime certificates, standard C libraries, and curl
7+ RUN apt-get update && apt-get install -y ca-certificates libc6 curl && rm -rf /var/lib/apt/lists/*
198
209WORKDIR /app
2110
22- # Copy the freshly compiled binary from the builder stage
23- COPY --from=builder /build/toolbox /app/toolbox
11+ # Dynamically fetch the latest version and download the binary
12+ RUN LATEST_VERSION=$(curl -s https://api.github.com/repos/googleapis/mcp-toolbox/releases/latest | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1 /' ) && \
13+ curl -L https://storage.googleapis.com/mcp-toolbox-for-databases/${LATEST_VERSION}/linux/amd64/toolbox -o /app/toolbox
2414RUN chmod +x /app/toolbox
2515
2616# Copy the extension's skills and configuration into the container
@@ -32,5 +22,3 @@ RUN touch tools.yaml
3222
3323# Expose HTTP API and UI endpoints to successfully pass Cloud Run health checks
3424ENTRYPOINT ["/app/toolbox" , "--prebuilt" , "cloud-sql-postgres" , "--address=0.0.0.0" , "--port=8080" , "--enable-api" , "--ui" ]
35-
36-
0 commit comments