From 6afd0e8a41457ca309b02c46bf44e7a211529153 Mon Sep 17 00:00:00 2001 From: Sonny May Date: Wed, 4 Nov 2026 15:08:57 +0000 Subject: [PATCH] chore: add HEALTHCHECK to backend Dockerfile Lets Docker/compose mark the container unhealthy if /health stops answering. Uses python urllib since the slim image has no curl. Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_0171zWznmWMz5ViBpaUpXEw7 --- backend/Dockerfile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/backend/Dockerfile b/backend/Dockerfile index 07611c6..68083c4 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -26,4 +26,8 @@ USER app EXPOSE 8000 +# Mark the container unhealthy if the API stops answering /health (no curl in slim image). +HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \ + CMD ["python", "-c", "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8000/health', timeout=4)"] + CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]