This commit is contained in:
Henrique Dias 2017-08-04 14:10:23 +01:00
parent b7887ed162
commit 1234ee32e4
No known key found for this signature in database
GPG Key ID: 936F5EB68D786730
2 changed files with 6 additions and 2 deletions

View File

@ -7,7 +7,8 @@ RUN apk add --no-cache git
RUN go get ./...
WORKDIR /go/src/github.com/hacdias/filemanager/cmd/filemanager
RUN go install
RUN go build -ldflags "-X main.version=$(git tag -l --points-at HEAD)"
RUN mv filemanager /go/bin/filemanager
FROM alpine:latest
COPY --from=0 /go/bin/filemanager /usr/local/bin/filemanager

View File

@ -87,10 +87,13 @@ func setupViper() {
}
func printVersion() {
version = strings.TrimSpace(version)
if version == "" {
fmt.Println("filemanager is at an untracked version")
} else {
fmt.Println("filemanager", version)
version = strings.TrimPrefix(version, "v")
fmt.Println("filemanager version", version)
}
os.Exit(0)