feat: inject version string into binary via Docker build argument
Release / release (pull_request) Successful in 29s

This commit is contained in:
2026-06-12 14:43:20 +01:00
parent e6d34c730a
commit 416684c0c1
2 changed files with 4 additions and 2 deletions
+3 -1
View File
@@ -6,11 +6,13 @@ WORKDIR /app
# Copy source code
COPY . .
ARG APP_VERSION=dev
# Run go mod tidy to generate go.sum based on source
RUN go mod tidy
# Build the application
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o /app/bin/goencode ./cmd/goencode
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w -X main.Version=${APP_VERSION}" -o /app/bin/goencode ./cmd/goencode
# Final stage
FROM debian:bookworm-slim