File tree Expand file tree Collapse file tree 3 files changed +7
-1
lines changed Expand file tree Collapse file tree 3 files changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -55,6 +55,8 @@ dockers:
5555 - cmd
5656 - internal
5757 - .git
58+ build_flag_templates :
59+ - " --build-arg=VERSION={{ .Version }}"
5860
5961release :
6062 github :
Original file line number Diff line number Diff line change 11FROM golang:1.15-alpine as builder
22
33ENV BUILD_IN_DOCKER true
4+ ARG VERSION
45
56# ca-certificates is needed to add the certificates on the next image
67# since it's FROM scratch, it does not have any certificates
Original file line number Diff line number Diff line change @@ -12,7 +12,10 @@ LDFLAGS=(
1212
1313# If we are build from the dockerfile only build required binary
1414if [[ " ${BUILD_IN_DOCKER} " == " true" ]]; then
15- GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -ldflags " ${LDFLAGS[*]} " ./cmd/scw
15+ if [[ " ${VERSION} " != " " ]]; then
16+ LDFLAGS+=(-X main.Version=" ${VERSION} " )
17+ fi
18+ GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -ldflags " ${LDFLAGS[*]} " ./cmd/scw
1619 exit 0
1720 fi
1821
You can’t perform that action at this time.
0 commit comments