From 6fcd53d2a02ea99b86c9a40fa344a27f541c3471 Mon Sep 17 00:00:00 2001 From: Wayback Archiver <66856220+waybackarchiver@users.noreply.github.com> Date: Tue, 9 May 2023 15:11:37 +0000 Subject: [PATCH] Fix tag describe in makefile (#65) * Fix tag describe in makefile * Use build directive from makefile --- Dockerfile | 2 +- Makefile | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index cfe3f48..42ce2d4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 diff --git a/Makefile b/Makefile index 8bc4c92..7b65151 100644 --- a/Makefile +++ b/Makefile @@ -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: