From c08108f44856557887dbff6b0a16cf1a387b43a8 Mon Sep 17 00:00:00 2001 From: Gianni Carafa Date: Wed, 1 Nov 2023 22:01:27 +0100 Subject: [PATCH] add limits --- cmd/main.go | 7 ++++++- docker-compose.yaml | 10 +++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/cmd/main.go b/cmd/main.go index a7f504e..15a15de 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -15,7 +15,12 @@ import ( func main() { - //os.Setenv("HTTP_PROXY", "http://localhost:3000") + if os.Getenv("PORT_PROXY") == "" { + os.Setenv("PORT_PROXY", "3000") + } + if os.Getenv("HTTP_PROXY") == "" { + os.Setenv("HTTP_PROXY", "http://127.0.0.1:"+os.Getenv("PORT_PROXY")) + } proxyForkID := uintptr(0) if runtime.GOOS == "darwin" { diff --git a/docker-compose.yaml b/docker-compose.yaml index d49ceef..6f88883 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -12,4 +12,12 @@ services: - GODEBUG=netdns=go+4 ports: - "2000:2000" - - "8080:3000" \ No newline at end of file + - "8080:3000" + deploy: + resources: + limits: + cpus: "0.50" + memory: 512M + reservations: + cpus: "0.25" + memory: 128M \ No newline at end of file