Skip to content

Commit 6fcd53d

Browse files
Fix tag describe in makefile (#65)
* Fix tag describe in makefile * Use build directive from makefile
1 parent d898e7a commit 6fcd53d

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ FROM golang:1.18 as build
44
WORKDIR /usr/src/wireproxy
55
COPY . .
66

7-
RUN CGO_ENABLED=0 go build ./cmd/wireproxy
7+
RUN make
88

99
# Now copy it into our base image.
1010
FROM gcr.io/distroless/static-debian11:nonroot

Makefile

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
export GO ?= go
2+
export CGO_ENABLED = 0
3+
4+
TAG := $(shell git describe --always --tags $(git rev-list --tags --max-count=1) --match v*)
25

36
.PHONY: all
47
all: wireproxy
58

69
.PHONY: wireproxy
710
wireproxy:
8-
tag="$$(git describe --tag 2>/dev/null)" && \
9-
${GO} build -ldflags "-X 'main.version=$$tag'" ./cmd/wireproxy
11+
${GO} build -trimpath -ldflags "-s -w -X 'main.version=${TAG}'" ./cmd/wireproxy
1012

1113
.PHONY: clean
1214
clean:

0 commit comments

Comments
 (0)