From 6f40702825d26818bf1c70155109a9f856374b38 Mon Sep 17 00:00:00 2001 From: Miguel Mota Date: Wed, 5 Aug 2020 09:13:18 -0700 Subject: [PATCH] Update Dockerfile --- Dockerfile | 3 ++- Makefile | 2 +- cointop/statusbar.go | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 7440ed3..bfd2a90 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,9 +2,10 @@ FROM golang:1.14 RUN mkdir /app WORKDIR /app +ARG VERSION ADD . /app/ -RUN go build -o main . +RUN go build -ldflags=-s -ldflags=-w -ldflags=-X=github.com/miguelmota/cointop/cointop.version=$VERSION -o main . RUN mv main /bin/cointop ENTRYPOINT cointop diff --git a/Makefile b/Makefile index 55117cd..31730f9 100644 --- a/Makefile +++ b/Makefile @@ -188,7 +188,7 @@ release: VERSION=$(VERSION) goreleaser docker-build: - docker build -t cointop/cointop . + docker build --build-arg VERSION=$(VERSION) -t cointop/cointop . docker-run: docker run -it cointop/cointop diff --git a/cointop/statusbar.go b/cointop/statusbar.go index d6b11a5..da6893f 100644 --- a/cointop/statusbar.go +++ b/cointop/statusbar.go @@ -55,7 +55,7 @@ func (ct *Cointop) UpdateStatusbar(s string) error { base := fmt.Sprintf("%s%s %sHelp %sChart %sRange %sSearch %sConvert %s %s %sSave", "[Q]", quitText, "[?]", "[Enter]", "[[ ]]", "[/]", "[C]", favoritesText, portfolioText, "[CTRL-S]") str := pad.Right(fmt.Sprintf("%v %sPage %v/%v %s", base, "[← →]", currpage, totalpages, s), ct.maxTableWidth, " ") - v := fmt.Sprintf("v%s", ct.Version()) + v := fmt.Sprintf("%s", ct.Version()) end := len(str) - len(v) + 2 if end > len(str) { end = len(str)