Only set memory limit using env in Dockerfile

master
Jan-Lukas Else 4 days ago
parent c559cf7ea9
commit ea0f1bfe05
  1. 1
      Dockerfile
  2. 10
      garbagecollector.go
  3. 3
      main.go

@ -31,6 +31,7 @@ EXPOSE 443
EXPOSE 8080
CMD ["GoBlog"]
HEALTHCHECK --interval=1m --timeout=10s CMD GoBlog healthcheck
ENV GOMEMLIMIT=100MiB
RUN apk add --no-cache tzdata tor
RUN apk add --no-cache --repository=http://dl-cdn.alpinelinux.org/alpine/edge/main sqlite-dev
COPY templates/ /app/templates/

@ -1,10 +0,0 @@
package main
import (
"runtime/debug"
)
func initGC() {
// Set memory limit to 100 MB
debug.SetMemoryLimit(100 * 1000 * 1000)
}

@ -53,9 +53,6 @@ func main() {
}()
}
// Init regular garbage collection
initGC()
app := &goBlog{
httpClient: newHttpClient(),
}

Loading…
Cancel
Save