From a499446366cf43e2ee91a5ab5012dbb11d6df0e4 Mon Sep 17 00:00:00 2001 From: MayaTheShy Date: Sun, 22 Mar 2026 20:42:37 -0400 Subject: [PATCH] fix: use wget for Docker health check instead of node Spawning a full Node process for health checks is slow on Alpine and can exceed the 3s timeout, causing the container to be marked unhealthy. Use wget (built into Alpine) instead, and increase start_period to 15s. --- web/docker-compose.yml | 6 +++--- web/server/Dockerfile | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/web/docker-compose.yml b/web/docker-compose.yml index 8b63c42..ce16203 100644 --- a/web/docker-compose.yml +++ b/web/docker-compose.yml @@ -10,10 +10,10 @@ services: - TURTLE_SERVER_URL=${TURTLE_SERVER_URL:-} restart: unless-stopped healthcheck: - test: ["CMD", "node", "-e", "require('http').get('http://localhost:3001/api/health',r=>{process.exit(r.statusCode===200?0:1)}).on('error',()=>process.exit(1))"] + test: ["CMD", "wget", "-qO-", "http://localhost:3001/api/health"] interval: 10s - timeout: 3s - start_period: 5s + timeout: 5s + start_period: 15s retries: 3 client: diff --git a/web/server/Dockerfile b/web/server/Dockerfile index abb0aaa..c09e76d 100644 --- a/web/server/Dockerfile +++ b/web/server/Dockerfile @@ -26,8 +26,8 @@ RUN chmod +x /usr/local/bin/docker-entrypoint.sh EXPOSE 3001 -HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \ - CMD node -e "require('http').get('http://localhost:3001/api/health',r=>{process.exit(r.statusCode===200?0:1)}).on('error',()=>process.exit(1))" +HEALTHCHECK --interval=10s --timeout=5s --start_period=15s --retries=3 \ + CMD wget -qO- http://localhost:3001/api/health || exit 1 ENTRYPOINT ["docker-entrypoint.sh"] CMD ["node", "server.js"]