From 7fd993dce9a5d1b0ce0afa56a170b57e63e58766 Mon Sep 17 00:00:00 2001 From: Sam Morrow Date: Thu, 3 Apr 2025 12:54:53 +0200 Subject: [PATCH] add ld flags so version is included in docker releases --- Dockerfile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 6b66afb68..7cb58d8b3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,5 @@ +ARG VERSION="dev" + FROM golang:1.23.7 AS build # Set the working directory WORKDIR /build @@ -6,7 +8,8 @@ COPY . . # Install dependencies RUN go mod download # Build the server -RUN CGO_ENABLED=0 go build -o github-mcp-server cmd/github-mcp-server/main.go +RUN 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 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