mirror of
https://github.com/moul/sshportal.git
synced 2025-09-11 23:24:33 +08:00
Add better versionning
This commit is contained in:
parent
0b137e1939
commit
20a2ffcd6c
3 changed files with 11 additions and 8 deletions
|
@ -2,7 +2,7 @@
|
|||
FROM golang:1.9 as builder
|
||||
COPY . /go/src/github.com/moul/sshportal
|
||||
WORKDIR /go/src/github.com/moul/sshportal
|
||||
RUN CGO_ENABLED=1 go build -tags netgo -ldflags '-extldflags "-static"' -v -o /go/bin/sshportal
|
||||
RUN make _docker_install
|
||||
|
||||
# minimal runtime
|
||||
FROM scratch
|
||||
|
|
9
Makefile
9
Makefile
|
@ -1,12 +1,15 @@
|
|||
PACKAGE ?= github.com/moul/sshportal
|
||||
GIT_SHA ?= $(shell git rev-parse HEAD)
|
||||
GIT_TAG ?= $(shell git describe --tags --always)
|
||||
GIT_BRANCH ?= $(shell git rev-parse --abbrev-ref HEAD)
|
||||
LDFLAGS ?= "-X $(PACKAGE)/main.GIT_SHA=$(GIT_SHA) -X $(PACKAGE)/main.GIT_TAG=$(GIT_TAG) -X $(PACKAGE)/main.GIT_BRANCH=$(GIT_BRANCH)"
|
||||
LDFLAGS ?= -X main.GIT_SHA=$(GIT_SHA) -X main.GIT_TAG=$(GIT_TAG) -X main.GIT_BRANCH=$(GIT_BRANCH)
|
||||
|
||||
.PHONY: install
|
||||
install:
|
||||
go install -ldflags $(LDFLAGS) .
|
||||
go install -ldflags '$(LDFLAGS)' .
|
||||
|
||||
.PHONY: _docker_install
|
||||
_docker_install:
|
||||
CGO_ENABLED=1 go build -ldflags '-extldflags "-static" $(LDFLAGS)' -tags netgo -v -o /go/bin/sshportal
|
||||
|
||||
.PHONY: dev
|
||||
dev:
|
||||
|
|
8
main.go
8
main.go
|
@ -20,11 +20,11 @@ var (
|
|||
// VERSION should be updated by hand at each release
|
||||
VERSION = "1.0.0"
|
||||
// GIT_TAG will be overwritten automatically by the build system
|
||||
GIT_TAG = ""
|
||||
GIT_TAG string
|
||||
// GIT_SHA will be overwritten automatically by the build system
|
||||
GIT_SHA = ""
|
||||
GIT_SHA string
|
||||
// GIT_BRANCH will be overwritten automatically by the build system
|
||||
GIT_BRANCH = ""
|
||||
GIT_BRANCH string
|
||||
)
|
||||
|
||||
type sshportalContextKey string
|
||||
|
@ -39,7 +39,7 @@ func main() {
|
|||
app := cli.NewApp()
|
||||
app.Name = path.Base(os.Args[0])
|
||||
app.Author = "Manfred Touron"
|
||||
app.Version = VERSION + "(" + GIT_SHA + ")"
|
||||
app.Version = VERSION + " (" + GIT_SHA + ")"
|
||||
app.Email = "https://github.com/moul/sshportal"
|
||||
app.Flags = []cli.Flag{
|
||||
cli.StringFlag{
|
||||
|
|
Loading…
Add table
Reference in a new issue