mirror of https://github.com/jlelse/GoBlog
Add heartbeat endpoint and improve dockerfile
This commit is contained in:
parent
bbbabdb335
commit
610113e9c9
|
@ -1,19 +1,17 @@
|
||||||
FROM golang:1.16-alpine3.13 as build
|
FROM golang:1.16-alpine3.13 as build
|
||||||
RUN apk add --no-cache git gcc musl-dev sqlite-dev
|
RUN apk add --no-cache git gcc musl-dev sqlite-dev
|
||||||
ADD *.go /app/
|
|
||||||
ADD go.mod /app/
|
|
||||||
ADD go.sum /app/
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
ADD *.go go.mod go.sum /app/
|
||||||
RUN go build --tags "libsqlite3 linux sqlite_fts5"
|
RUN go build --tags "libsqlite3 linux sqlite_fts5"
|
||||||
|
|
||||||
FROM alpine:3.13
|
FROM alpine:3.13
|
||||||
RUN apk add --no-cache sqlite-dev tzdata tor
|
RUN apk add --no-cache sqlite-dev tzdata tor
|
||||||
COPY templates/ /app/templates/
|
COPY templates/ /app/templates/
|
||||||
COPY --from=build /app/GoBlog /bin/
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
VOLUME /app/config
|
VOLUME /app/config
|
||||||
VOLUME /app/data
|
VOLUME /app/data
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
EXPOSE 443
|
EXPOSE 443
|
||||||
EXPOSE 8080
|
EXPOSE 8080
|
||||||
CMD ["GoBlog"]
|
CMD ["GoBlog"]
|
||||||
|
COPY --from=build /app/GoBlog /bin/
|
1
http.go
1
http.go
|
@ -50,6 +50,7 @@ func startServer() (err error) {
|
||||||
finalHandler = securityHeaders(finalHandler)
|
finalHandler = securityHeaders(finalHandler)
|
||||||
}
|
}
|
||||||
finalHandler = servertiming.Middleware(finalHandler, nil)
|
finalHandler = servertiming.Middleware(finalHandler, nil)
|
||||||
|
finalHandler = middleware.Heartbeat("/ping")(finalHandler)
|
||||||
finalHandler = middleware.Compress(flate.DefaultCompression)(finalHandler)
|
finalHandler = middleware.Compress(flate.DefaultCompression)(finalHandler)
|
||||||
finalHandler = middleware.Recoverer(finalHandler)
|
finalHandler = middleware.Recoverer(finalHandler)
|
||||||
if appConfig.Server.Logging {
|
if appConfig.Server.Logging {
|
||||||
|
|
Loading…
Reference in New Issue