From df183f11022ac89f83ac061d22b7c0859748c071 Mon Sep 17 00:00:00 2001 From: "Antonio Melo Jr." Date: Thu, 28 May 2026 14:54:10 -0300 Subject: [PATCH 1/2] Adding docker compose resource limits to Backend container --- docker-compose.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 859bfb2..3daffcd 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -79,7 +79,6 @@ services: backend: image: 'ghcr.io/project-chip/csa-certification-tool-backend:2ac562d' - ports: - "8888:8888" - "50000:50000" @@ -100,6 +99,11 @@ services: privileged: true build: context: ./backend + deploy: + resources: + limits: + cpus: '2.5' # cap at 2.5 cores, leave 1.5 for OS + other services + memory: 1500M command: bash -c "./prestart.sh; python3 ./app/main.py" labels: - traefik.enable=true From 718d282380fac1fba4f8d52a9d49a2ed85a3a93f Mon Sep 17 00:00:00 2001 From: "Antonio Melo Jr." Date: Thu, 28 May 2026 16:52:09 -0300 Subject: [PATCH 2/2] Adding Environment variable configuration option instead of a hard-coded value only. --- docker-compose.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 3daffcd..a1b20f4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -102,8 +102,8 @@ services: deploy: resources: limits: - cpus: '2.5' # cap at 2.5 cores, leave 1.5 for OS + other services - memory: 1500M + cpus: '${BACKEND_CPU_LIMIT:-2.5}' # If no environment variables is provided, cap at 2.5 cores + memory: '${BACKEND_MEMORY_LIMIT:-2000M}' # If no environment variables is provided, cap at 2.0 GB command: bash -c "./prestart.sh; python3 ./app/main.py" labels: - traefik.enable=true