From 513ce74e40f87c86af1de3e0e0a85984e906f201 Mon Sep 17 00:00:00 2001 From: mmetc <92726601+mmetc@users.noreply.github.com> Date: Mon, 23 Sep 2024 14:23:59 +0200 Subject: [PATCH] make: report docker platform with --version (#70) this is required for base metrics too --- Dockerfile | 2 +- Makefile | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 16f7e79..aaaffc3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,7 +7,7 @@ WORKDIR /go/src/cs-aws-waf-bouncer RUN apk add --update --no-cache make git COPY . . -RUN make build +RUN make build DOCKER_BUILD=1 FROM alpine:latest COPY --from=build /go/src/cs-aws-waf-bouncer/crowdsec-aws-waf-bouncer /crowdsec-aws-waf-bouncer diff --git a/Makefile b/Makefile index a815f5d..1c2cb9e 100644 --- a/Makefile +++ b/Makefile @@ -18,6 +18,10 @@ LD_OPTS_VARS=\ -X 'github.com/crowdsecurity/go-cs-lib/version.BuildDate=$(BUILD_TIMESTAMP)' \ -X 'github.com/crowdsecurity/go-cs-lib/version.Tag=$(BUILD_TAG)' +ifneq (,$(DOCKER_BUILD)) +LD_OPTS_VARS += -X 'github.com/crowdsecurity/go-cs-lib/version.System=docker' +endif + export CGO_ENABLED=0 export LD_OPTS=-ldflags "-s -extldflags '-static' $(LD_OPTS_VARS)" \ -trimpath -tags netgo