Browse Source

Add heartbeat endpoint and improve dockerfile

master
Jan-Lukas Else 3 weeks ago
parent
commit
610113e9c9
2 changed files with 4 additions and 5 deletions
  1. +3
    -5
      Dockerfile
  2. +1
    -0
      http.go

+ 3
- 5
Dockerfile View File

@ -1,19 +1,17 @@
FROM golang:1.16-alpine3.13 as build
RUN apk add --no-cache git gcc musl-dev sqlite-dev
ADD *.go /app/
ADD go.mod /app/
ADD go.sum /app/
WORKDIR /app
ADD *.go go.mod go.sum /app/
RUN go build --tags "libsqlite3 linux sqlite_fts5"
FROM alpine:3.13
RUN apk add --no-cache sqlite-dev tzdata tor
COPY templates/ /app/templates/
COPY --from=build /app/GoBlog /bin/
WORKDIR /app
VOLUME /app/config
VOLUME /app/data
EXPOSE 80
EXPOSE 443
EXPOSE 8080
CMD ["GoBlog"]
CMD ["GoBlog"]
COPY --from=build /app/GoBlog /bin/

+ 1
- 0
http.go View File

@ -50,6 +50,7 @@ func startServer() (err error) {
finalHandler = securityHeaders(finalHandler)
}
finalHandler = servertiming.Middleware(finalHandler, nil)
finalHandler = middleware.Heartbeat("/ping")(finalHandler)
finalHandler = middleware.Compress(flate.DefaultCompression)(finalHandler)
finalHandler = middleware.Recoverer(finalHandler)
if appConfig.Server.Logging {


Loading…
Cancel
Save