Include build arch info into binary

This commit is contained in:
Dan Sosedoff
2022-12-06 17:55:27 -06:00
parent f48cc5f007
commit 829658ae4d
2 changed files with 10 additions and 0 deletions

View File

@@ -1,6 +1,7 @@
PKG = github.com/sosedoff/pgweb
GIT_COMMIT ?= $(shell git rev-parse HEAD)
BUILD_TIME ?= $(shell date -u +"%Y-%m-%dT%H:%M:%SZ" | tr -d '\n')
BUILD_ARCH ?= $(shell uname -s | awk '{print tolower($0)}')/$(shell uname -m)
GO_VERSION ?= $(shell go version | awk {'print $$3'})
DOCKER_RELEASE_TAG = "sosedoff/pgweb:$(shell git describe --abbrev=0 --tags | sed 's/v//')"
@@ -9,6 +10,7 @@ DOCKER_LATEST_TAG = "sosedoff/pgweb:latest"
LDFLAGS = -s -w
LDFLAGS += -X $(PKG)/pkg/command.GitCommit=$(GIT_COMMIT)
LDFLAGS += -X $(PKG)/pkg/command.BuildTime=$(BUILD_TIME)
LDFLAGS += -X $(PKG)/pkg/command.BuildArch=$(BUILD_ARCH)
LDFLAGS += -X $(PKG)/pkg/command.GoVersion=$(GO_VERSION)
usage: