Skip to content

Commit

Permalink
Fix tag describe in makefile (#65)
Browse files Browse the repository at this point in the history
* Fix tag describe in makefile

* Use build directive from makefile
  • Loading branch information
waybackarchiver committed May 9, 2023
1 parent d898e7a commit 6fcd53d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ FROM golang:1.18 as build
WORKDIR /usr/src/wireproxy
COPY . .

RUN CGO_ENABLED=0 go build ./cmd/wireproxy
RUN make

# Now copy it into our base image.
FROM gcr.io/distroless/static-debian11:nonroot
Expand Down
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
export GO ?= go
export CGO_ENABLED = 0

TAG := $(shell git describe --always --tags $(git rev-list --tags --max-count=1) --match v*)

.PHONY: all
all: wireproxy

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

.PHONY: clean
clean:
Expand Down

0 comments on commit 6fcd53d

Please sign in to comment.