From ea0f1bfe05ee54d8f80b7e0aadfa15d9cf3131ad Mon Sep 17 00:00:00 2001 From: Jan-Lukas Else Date: Fri, 5 Aug 2022 09:43:36 +0200 Subject: [PATCH] Only set memory limit using env in Dockerfile --- Dockerfile | 1 + garbagecollector.go | 10 ---------- main.go | 3 --- 3 files changed, 1 insertion(+), 13 deletions(-) delete mode 100644 garbagecollector.go diff --git a/Dockerfile b/Dockerfile index df94349..fe1ff86 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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/ diff --git a/garbagecollector.go b/garbagecollector.go deleted file mode 100644 index 2d18363..0000000 --- a/garbagecollector.go +++ /dev/null @@ -1,10 +0,0 @@ -package main - -import ( - "runtime/debug" -) - -func initGC() { - // Set memory limit to 100 MB - debug.SetMemoryLimit(100 * 1000 * 1000) -} diff --git a/main.go b/main.go index 74fe02c..1fbfd04 100644 --- a/main.go +++ b/main.go @@ -53,9 +53,6 @@ func main() { }() } - // Init regular garbage collection - initGC() - app := &goBlog{ httpClient: newHttpClient(), }