Add githash to docker builds
This commit is contained in:
parent
7558a2162e
commit
956d7cf3f3
|
@ -6,6 +6,6 @@ RUN apk update && apk add go git gcc musl-dev ca-certificates \
|
||||||
&& cd /go/src/github.com/42wim/matterbridge \
|
&& cd /go/src/github.com/42wim/matterbridge \
|
||||||
&& export GOPATH=/go \
|
&& export GOPATH=/go \
|
||||||
&& go get \
|
&& go get \
|
||||||
&& go build -o /bin/matterbridge \
|
&& go build -x -ldflags "-X main.githash=$(git log --pretty=format:'%h' -n 1)" -o /bin/matterbridge \
|
||||||
&& rm -rf /go \
|
&& rm -rf /go \
|
||||||
&& apk del --purge git go gcc musl-dev
|
&& apk del --purge git go gcc musl-dev
|
||||||
|
|
|
@ -9,7 +9,10 @@ import (
|
||||||
log "github.com/Sirupsen/logrus"
|
log "github.com/Sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
||||||
var version = "0.9.3-dev"
|
var (
|
||||||
|
version = "0.9.3-dev"
|
||||||
|
githash string
|
||||||
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
log.SetFormatter(&log.TextFormatter{FullTimestamp: true})
|
log.SetFormatter(&log.TextFormatter{FullTimestamp: true})
|
||||||
|
@ -21,25 +24,25 @@ func main() {
|
||||||
flagVersion := flag.Bool("version", false, "show version")
|
flagVersion := flag.Bool("version", false, "show version")
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
if *flagVersion {
|
if *flagVersion {
|
||||||
fmt.Println("version:", version)
|
fmt.Printf("version: %s %s\n", version, githash)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
if *flagDebug {
|
if *flagDebug {
|
||||||
log.Info("enabling debug")
|
log.Info("Enabling debug")
|
||||||
log.SetLevel(log.DebugLevel)
|
log.SetLevel(log.DebugLevel)
|
||||||
}
|
}
|
||||||
fmt.Println("running version", version)
|
log.Printf("Running version %s %s", version, githash)
|
||||||
cfg := config.NewConfig(*flagConfig)
|
cfg := config.NewConfig(*flagConfig)
|
||||||
for _, gw := range cfg.SameChannelGateway {
|
for _, gw := range cfg.SameChannelGateway {
|
||||||
if !gw.Enable {
|
if !gw.Enable {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
fmt.Printf("starting samechannel gateway %#v\n", gw.Name)
|
log.Printf("Starting samechannel gateway %#v", gw.Name)
|
||||||
g := samechannelgateway.New(cfg, &gw)
|
g := samechannelgateway.New(cfg, &gw)
|
||||||
err := g.Start()
|
err := g.Start()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("starting gateway failed %#v", err)
|
log.Fatalf("Starting gateway failed %#v", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,11 +50,11 @@ func main() {
|
||||||
if !gw.Enable {
|
if !gw.Enable {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
fmt.Printf("starting gateway %#v\n", gw.Name)
|
log.Printf("Starting gateway %#v", gw.Name)
|
||||||
g := gateway.New(cfg, &gw)
|
g := gateway.New(cfg, &gw)
|
||||||
err := g.Start()
|
err := g.Start()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("starting gateway failed %#v", err)
|
log.Fatalf("Starting gateway failed %#v", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
select {}
|
select {}
|
||||||
|
|
Loading…
Reference in New Issue