5
0
mirror of https://github.com/cwinfo/matterbridge.git synced 2024-11-22 09:20:27 +00:00

Add githash to docker builds

This commit is contained in:
Wim 2017-02-17 22:32:42 +01:00
parent 7558a2162e
commit 956d7cf3f3
2 changed files with 12 additions and 9 deletions

View File

@ -6,6 +6,6 @@ RUN apk update && apk add go git gcc musl-dev ca-certificates \
&& cd /go/src/github.com/42wim/matterbridge \
&& export GOPATH=/go \
&& 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 \
&& apk del --purge git go gcc musl-dev

View File

@ -9,7 +9,10 @@ import (
log "github.com/Sirupsen/logrus"
)
var version = "0.9.3-dev"
var (
version = "0.9.3-dev"
githash string
)
func init() {
log.SetFormatter(&log.TextFormatter{FullTimestamp: true})
@ -21,25 +24,25 @@ func main() {
flagVersion := flag.Bool("version", false, "show version")
flag.Parse()
if *flagVersion {
fmt.Println("version:", version)
fmt.Printf("version: %s %s\n", version, githash)
return
}
flag.Parse()
if *flagDebug {
log.Info("enabling debug")
log.Info("Enabling debug")
log.SetLevel(log.DebugLevel)
}
fmt.Println("running version", version)
log.Printf("Running version %s %s", version, githash)
cfg := config.NewConfig(*flagConfig)
for _, gw := range cfg.SameChannelGateway {
if !gw.Enable {
continue
}
fmt.Printf("starting samechannel gateway %#v\n", gw.Name)
log.Printf("Starting samechannel gateway %#v", gw.Name)
g := samechannelgateway.New(cfg, &gw)
err := g.Start()
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 {
continue
}
fmt.Printf("starting gateway %#v\n", gw.Name)
log.Printf("Starting gateway %#v", gw.Name)
g := gateway.New(cfg, &gw)
err := g.Start()
if err != nil {
log.Fatalf("starting gateway failed %#v", err)
log.Fatalf("Starting gateway failed %#v", err)
}
}
select {}