Skip to content

Commit 99bb0aa

Browse files
committed
Upgrade Docker to go 1.15 & don't release as a scratch image
1 parent e6de8b6 commit 99bb0aa

File tree

5 files changed

+34
-23
lines changed

5 files changed

+34
-23
lines changed

Dockerfile

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
FROM golang:1.14.3 as builder
1+
FROM golang:1.15 as builder
22
WORKDIR /go/src/github.com/parkr/ping
33
EXPOSE 3306
44
COPY . .
55
RUN go version
6-
RUN go install github.com/parkr/ping/...
6+
RUN go install github.com/parkr/ping/... && ls -l /go/bin
77

8-
FROM scratch
98
HEALTHCHECK --start-period=1s --interval=30s --timeout=5s --retries=1 \
10-
CMD [ "/bin/ping-healthcheck" ]
11-
COPY --from=builder /go/bin/ping-healthcheck /bin/ping-healthcheck
12-
COPY --from=builder /go/bin/ping /bin/ping-server
13-
ENTRYPOINT [ "/bin/ping-server" ]
9+
CMD [ "/go/bin/ping-healthcheck" ]
10+
11+
ENTRYPOINT [ "/go/bin/ping" ]

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,6 @@ docker-test: docker-build
2323

2424
docker-release: docker-build
2525
docker push parkr/ping:$(REV)
26+
27+
dive: docker-build
28+
dive parkr/ping:$(REV)

go.mod

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ module github.com/parkr/ping
33
go 1.14
44

55
require (
6-
github.com/jmoiron/sqlx v0.0.0-20170121103519-f980a91bdc37
7-
github.com/lib/pq v1.4.0 // indirect
6+
github.com/jmoiron/sqlx v1.2.0
87
github.com/mattn/go-sqlite3 v2.0.3+incompatible
9-
github.com/parkr/gossip v0.0.0-20170207041538-a9ea9f924daf
8+
google.golang.org/appengine v1.6.7 // indirect
109
)

go.sum

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
1-
github.com/go-sql-driver/mysql v1.5.0 h1:ozyZYNQW3x3HtqT1jira07DN2PArx2v7/mN66gGcHOs=
2-
github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
3-
github.com/jmoiron/sqlx v0.0.0-20170121103519-f980a91bdc37 h1:FZc3adQBtm3UfBaJmQ6PskygMUPuJkjOK8p0z6GEYUE=
4-
github.com/jmoiron/sqlx v0.0.0-20170121103519-f980a91bdc37/go.mod h1:IiEW3SEiiErVyFdH8NTuWjSifiEQKUoyK3LNqr2kCHU=
5-
github.com/lib/pq v1.4.0 h1:TmtCFbH+Aw0AixwyttznSMQDgbR5Yed/Gg6S8Funrhc=
6-
github.com/lib/pq v1.4.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
7-
github.com/mattn/go-sqlite3 v1.14.6/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
1+
github.com/go-sql-driver/mysql v1.4.0 h1:7LxgVwFb2hIQtMm87NdgAVfXjnt4OePseqT1tKx+opk=
2+
github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w=
3+
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
4+
github.com/jmoiron/sqlx v1.2.0 h1:41Ip0zITnmWNR/vHV+S4m+VoUivnWY5E4OJfLZjCJMA=
5+
github.com/jmoiron/sqlx v1.2.0/go.mod h1:1FEQNm3xlJgrMD+FBdI9+xvCksHtbpVBBw5dYhBSsks=
6+
github.com/lib/pq v1.0.0 h1:X5PMW56eZitiTeO7tKzZxFCSpbFZJtkMMooicw2us9A=
7+
github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
8+
github.com/mattn/go-sqlite3 v1.9.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
89
github.com/mattn/go-sqlite3 v2.0.3+incompatible h1:gXHsfypPkaMZrKbD5209QV9jbUTJKjyR5WD3HYQSd+U=
910
github.com/mattn/go-sqlite3 v2.0.3+incompatible/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
10-
github.com/parkr/gossip v0.0.0-20170207041538-a9ea9f924daf h1:rUZlwm2L4Px9+c1V7V2Cdddj55NhfOw8kcILdFHt1eQ=
11-
github.com/parkr/gossip v0.0.0-20170207041538-a9ea9f924daf/go.mod h1:31ZbvXsmmURO02gN4g+bj9pTwBIIdyniEWqzmI4gog4=
11+
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
12+
golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
13+
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
14+
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
15+
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
16+
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
17+
google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c=
18+
google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=

utils.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
package main
22

33
import (
4+
"encoding/json"
45
"fmt"
56
"net/http"
6-
7-
"github.com/parkr/gossip/serializer"
87
)
98

10-
func writeJsonResponse(w http.ResponseWriter, json interface{}) {
9+
func writeJsonResponse(w http.ResponseWriter, input interface{}) {
1110
w.Header().Set("Content-Type", "application/json")
12-
fmt.Fprintf(w, serializer.MarshalJson(json))
11+
data, err := json.Marshal(input)
12+
if err != nil {
13+
fmt.Fprintf(w, `{"error":"json, `+err.Error()+`"}`)
14+
} else {
15+
w.Write(data)
16+
}
1317
}

0 commit comments

Comments
 (0)