This commit is contained in:
Mac Chiang
2019-12-18 12:35:44 +08:00
parent 43510e18e2
commit f9f5c278ec
6 changed files with 44 additions and 3 deletions

12
cli/Dockerfile Normal file
View File

@@ -0,0 +1,12 @@
# build stage
FROM golang:alpine AS build-env
RUN set -eux; \
apk add --no-cache --virtual .build-deps \
git gcc libc-dev;
ENV GO111MODULE on
WORKDIR /go/main
ADD go.mod go.sum ./
RUN go mod download
# WORKDIR /go/src/status-monitor
ADD main.go ./
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -a -installsuffix cgo -o main main.go

View File

@@ -1,3 +1,3 @@
build: build:
docker build --pull -t ${PREFIX}/$$(gcloud config get-value project 2> /dev/null)/status-monitor:$(TAG) . docker build .

View File

@@ -1,3 +1,12 @@
module main module main
go 1.13 go 1.13
require (
github.com/castawaylabs/cachet-monitor v1.1.0 // indirect
github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815 // indirect
github.com/macchiang/cachet-monitor v1.1.0 // indirect
github.com/mitchellh/mapstructure v1.1.2 // indirect
github.com/sirupsen/logrus v1.4.2 // indirect
gopkg.in/yaml.v2 v2.2.7 // indirect
)

20
cli/go.sum Normal file
View File

@@ -0,0 +1,20 @@
github.com/castawaylabs/cachet-monitor v1.1.0 h1:T8NshhwHjEIbdlWkeRBuYdnU2ktpBnZpwgh6nxrp62w=
github.com/castawaylabs/cachet-monitor v1.1.0/go.mod h1:FBK1+4+fLd80wd/+U4Zy8YshPlpgWEvup79AoapOZ2E=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815 h1:bWDMxwH3px2JBh6AyO7hdCn/PkvCZXii8TGj7sbtEbQ=
github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/macchiang/cachet-monitor v1.1.0 h1:um5ymKBF11Dau8yKCAg82HS6F/og0tODiIOLOdwnnzc=
github.com/macchiang/cachet-monitor v1.1.0/go.mod h1:cNiyqtsa4pEzPn0v2tlf6oejVg4mfUts2qNaxFnCDeE=
github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE=
github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4=
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
golang.org/x/sys v0.0.0-20190422165155-953cdadca894 h1:Cz4ceDQGXuKRnVBDTS23GTn/pU5OE2C0WrNTOYK1Uuc=
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.2.7 h1:VUgggvou5XRW9mHwD/yXxIYSMtY0zoKQf/v226p2nyo=
gopkg.in/yaml.v2 v2.2.7/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=

View File

@@ -11,7 +11,7 @@ import (
"strings" "strings"
"sync" "sync"
"github.com/Sirupsen/logrus" "github.com/sirupsen/logrus"
cachet "github.com/macchiang/cachet-monitor" cachet "github.com/macchiang/cachet-monitor"
docopt "github.com/docopt/docopt-go" docopt "github.com/docopt/docopt-go"
"github.com/mitchellh/mapstructure" "github.com/mitchellh/mapstructure"

View File

@@ -4,7 +4,7 @@ import (
"sync" "sync"
"time" "time"
"github.com/Sirupsen/logrus" "github.com/sirupsen/logrus"
) )
const DefaultInterval = time.Second * 60 const DefaultInterval = time.Second * 60