-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathDockerfile
More file actions
33 lines (24 loc) · 989 Bytes
/
Dockerfile
File metadata and controls
33 lines (24 loc) · 989 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# Stage 1: Build the Go application
FROM golang:1.23-alpine AS builder
# Set the working directory inside the container
WORKDIR /app
# Copy go.mod and go.sum files to download dependencies
COPY go.mod go.sum ./
RUN go mod download
# Copy the entire source code
COPY . .
# Build the Go application
# CGO_ENABLED=0 disables CGO for static linking (optional but often good for alpine)
# -ldflags="-s -w" strips debug information to reduce binary size
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o pprof-analyzer-mcp .
# Stage 2: Create the final lightweight image
FROM alpine:latest
# Set the working directory
WORKDIR /app
# Copy the built binary from the builder stage
COPY --from=builder /app/pprof-analyzer-mcp .
# (Optional) Add ca-certificates if your app needs to make HTTPS requests
# RUN apk --no-cache add ca-certificates
# Command to run the application when the container starts
# This will be the entry point for the STDIO server
CMD ["./pprof-analyzer-mcp"]