From 6288dcee900558600ec0f42643340972e41e4180 Mon Sep 17 00:00:00 2001 From: Shayon Mukherjee Date: Sun, 3 Nov 2024 10:03:18 -0500 Subject: [PATCH] Fix docker build and new version --- Dockerfile | 7 ++++++- cmd/root.go | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 6f9fa2c..2e12b82 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,7 +4,12 @@ COPY . . ARG VERSION=dev ARG COMMIT=none ARG DATE=unknown -RUN go build -v -ldflags="-s -w -X github.com/shayonj/pg_flo/cmd.version=${VERSION} -X github.com/shayonj/pg_flo/cmd.commit=${COMMIT} -X github.com/shayonj/pg_flo/cmd.date=${DATE}" -o pg_flo . +RUN CGO_ENABLED=0 GOOS=linux go build -v \ + -ldflags '-s -w \ + -X "github.com/shayonj/pg_flo/cmd.version=${VERSION}" \ + -X "github.com/shayonj/pg_flo/cmd.commit=${COMMIT}" \ + -X "github.com/shayonj/pg_flo/cmd.date=${DATE}"' \ + -o pg_flo . FROM alpine:latest COPY --from=builder /app/pg_flo /usr/local/bin/ diff --git a/cmd/root.go b/cmd/root.go index 706b1c9..8e7e518 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -144,7 +144,7 @@ func init() { versionCmd := &cobra.Command{ Use: "version", Short: "Print version information", - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, _ []string) { fmt.Printf("pg_flo version %s\n", formatVersion()) }, }