From 45a2ae93c80cefe210e2cc6e9bf993045482807a Mon Sep 17 00:00:00 2001 From: neon <18559658+neonsolstice@users.noreply.github.com> Date: Mon, 24 Aug 2026 23:21:43 +0000 Subject: [PATCH] perf(docker): use lightweight health probe Avoid launching a full Node runtime every 30 seconds so idle containers do not create unnecessary CPU, memory, and disk pressure. Let Compose inherit the image probe to keep one source of truth. Closes #1129 --- Dockerfile | 2 +- docker-compose.yml | 12 ------------ 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/Dockerfile b/Dockerfile index 098a7630f..26b737253 100644 --- a/Dockerfile +++ b/Dockerfile @@ -80,7 +80,7 @@ RUN sed -i 's/\r$//' /app/entrypoint.sh && chmod +x /app/entrypoint.sh /app/bin/ EXPOSE 3000 HEALTHCHECK --interval=30s --timeout=5s --start-period=20s --retries=3 \ - CMD ["node", "-e", "const p=process.env.PORT||3000;fetch('http://127.0.0.1:'+p+'/api/v1/health').then(r=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))"] + CMD wget -q -T 4 -O /dev/null "http://127.0.0.1:${PORT:-3000}/api/v1/health" ENTRYPOINT ["/sbin/tini", "-s", "--"] CMD ["sh", "/app/entrypoint.sh"] diff --git a/docker-compose.yml b/docker-compose.yml index b0eca0b91..a2a5fa51a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -49,18 +49,6 @@ services: security_opt: - no-new-privileges:true stop_grace_period: 30s - healthcheck: - test: - [ - "CMD", - "node", - "-e", - "const p=process.env.PORT||3000;fetch('http://127.0.0.1:'+p+'/api/v1/health').then(r=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))", - ] - interval: 30s - timeout: 5s - retries: 3 - start_period: 20s postgres: container_name: bookorbit-db