Only set memory limit using env in Dockerfile

This commit is contained in:
Jan-Lukas Else 2022-08-05 09:43:36 +02:00
parent c559cf7ea9
commit ea0f1bfe05
3 changed files with 1 additions and 13 deletions

View File

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

View File

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

View File

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