Fix tag describe in makefile (#65)

* Fix tag describe in makefile

* Use build directive from makefile
This commit is contained in:
Wayback Archiver 2023-05-09 15:11:37 +00:00 committed by GitHub
parent d898e7a931
commit 6fcd53d2a0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 3 deletions

View file

@ -4,7 +4,7 @@ FROM golang:1.18 as build
WORKDIR /usr/src/wireproxy WORKDIR /usr/src/wireproxy
COPY . . COPY . .
RUN CGO_ENABLED=0 go build ./cmd/wireproxy RUN make
# Now copy it into our base image. # Now copy it into our base image.
FROM gcr.io/distroless/static-debian11:nonroot FROM gcr.io/distroless/static-debian11:nonroot

View file

@ -1,12 +1,14 @@
export GO ?= go export GO ?= go
export CGO_ENABLED = 0
TAG := $(shell git describe --always --tags $(git rev-list --tags --max-count=1) --match v*)
.PHONY: all .PHONY: all
all: wireproxy all: wireproxy
.PHONY: wireproxy .PHONY: wireproxy
wireproxy: wireproxy:
tag="$$(git describe --tag 2>/dev/null)" && \ ${GO} build -trimpath -ldflags "-s -w -X 'main.version=${TAG}'" ./cmd/wireproxy
${GO} build -ldflags "-X 'main.version=$$tag'" ./cmd/wireproxy
.PHONY: clean .PHONY: clean
clean: clean: