From 04881c9c40b62a4e83ed14f7ead0ffbcc43c4c4b Mon Sep 17 00:00:00 2001 From: Hunter Long Date: Mon, 18 Jun 2018 02:53:18 -0700 Subject: [PATCH] docker --- .travis.yml | 3 ++- Dockerfile | 10 ++++------ build.sh | 1 + services.go | 20 ++++++++++---------- web.go | 5 ++--- 5 files changed, 19 insertions(+), 20 deletions(-) diff --git a/.travis.yml b/.travis.yml index e6616d57..f6422faa 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,7 +17,7 @@ services: - mongodb env: - - VERSION=0.13 + - VERSION=0.14 matrix: allow_failures: @@ -37,6 +37,7 @@ deploy: - "build/statup-linux-x64" - "build/statup-linux-x32" - "build/statup-windows-x64.exe" + - "build/statup-linux-static" skip_cleanup: true notifications: diff --git a/Dockerfile b/Dockerfile index 4e4b9459..16c7699c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,12 +1,10 @@ FROM alpine -RUN apk add --no-cache libc6-compat +#RUN apk add --no-cache libc6-compat -ENV VERSION="v0.13" - -WORKDIR /app -RUN wget -q https://github.com/hunterlong/statup/releases/download/$VERSION/statup-linux-x64 -RUN chmod +x statup-linux-x64 && mv statup-linux-x64 /usr/local/bin/statup +ENV VERSION="v0.14" +#RUN wget -q https://github.com/hunterlong/statup/releases/download/$VERSION/statup-linux-static +#RUN chmod +x statup-linux-static && mv statup-linux-static /usr/local/bin/statup EXPOSE 8080 diff --git a/build.sh b/build.sh index e13314e4..2bd36d2b 100755 --- a/build.sh +++ b/build.sh @@ -14,6 +14,7 @@ xgo --targets=linux/386 --dest=build -ldflags="-X main.VERSION=$VERSION" ./ xgo --targets=windows/amd64 --dest=build -ldflags="-X main.VERSION=$VERSION" ./ +CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o build/statup-linux-static . cd build ls diff --git a/services.go b/services.go index 091e49b6..ffa2bdd5 100644 --- a/services.go +++ b/services.go @@ -15,16 +15,16 @@ var ( ) type Service struct { - Id int64 `db:"id,omitempty" json:"id"` - Name string `db:"name" json:"name"` - Domain string `db:"domain" json:"domain"` - Expected string `db:"expected" json:"expected"` - ExpectedStatus int `db:"expected_status" json:"expected_status"` - Interval int `db:"check_interval" json:"check_interval"` - Type string `db:"check_type" json:"type"` - Method string `db:"method" json:"method"` - Port int `db:"port" json:"port"` - CreatedAt time.Time `db:"created_at" json:"created_at"` + Id int64 `db:"id,omitempty" json:"id"` + Name string `db:"name" json:"name"` + Domain string `db:"domain" json:"domain"` + Expected string `db:"expected" json:"expected"` + ExpectedStatus int `db:"expected_status" json:"expected_status"` + Interval int `db:"check_interval" json:"check_interval"` + Type string `db:"check_type" json:"type"` + Method string `db:"method" json:"method"` + Port int `db:"port" json:"port"` + CreatedAt time.Time `db:"created_at" json:"created_at"` Online bool `json:"online"` Latency float64 `json:"latency"` Online24Hours float32 `json:"24_hours_online"` diff --git a/web.go b/web.go index 5e68b052..b313f725 100644 --- a/web.go +++ b/web.go @@ -308,9 +308,9 @@ func ServicesBadgeHandler(w http.ResponseWriter, r *http.Request) { var badge []byte if service.Online { - badge = []byte(``+service.Name+``+service.Name+`onlineonline`) + badge = []byte(`` + service.Name + `` + service.Name + `onlineonline`) } else { - badge = []byte(``+service.Name+``+service.Name+`offlineoffline`) + badge = []byte(`` + service.Name + `` + service.Name + `offlineoffline`) } w.Header().Set("Content-Type", "image/svg+xml") @@ -320,7 +320,6 @@ func ServicesBadgeHandler(w http.ResponseWriter, r *http.Request) { } - func ServicesViewHandler(w http.ResponseWriter, r *http.Request) { auth := IsAuthenticated(r) vars := mux.Vars(r)