Summary
Introduce a HEALTHCHECK instruction in the Dockerfile so the container can report its health status to Docker. This improves reliability by detecting when the server becomes unresponsive even if the process is still running.
Description
The Dockerfile currently builds and runs the webserver without exposing any health information to Docker. Adding a HEALTHCHECK allows Docker to periodically verify that the server is responding as expected. This is useful for debugging, local development, CI pipelines, and future orchestration environments.
A simple implementation can use curl to check the root endpoint or a dedicated /health endpoint if one is added later.
Example:
dockerfile
HEALTHCHECK --interval=30s --timeout=3s --retries=3
CMD curl -f http://localhost:8080/ || exit 1
Acceptance Criteria
Dockerfile includes a working HEALTHCHECK instruction.
Running docker ps shows container status as healthy or unhealthy.
Healthcheck failures are visible in Docker logs.
The healthcheck works consistently in local development and CI.
Additional Notes
If the project later introduces a /health endpoint, the healthcheck command can be updated to target that route for more precise diagnostics.
Summary
Introduce a HEALTHCHECK instruction in the Dockerfile so the container can report its health status to Docker. This improves reliability by detecting when the server becomes unresponsive even if the process is still running.
Description
The Dockerfile currently builds and runs the webserver without exposing any health information to Docker. Adding a HEALTHCHECK allows Docker to periodically verify that the server is responding as expected. This is useful for debugging, local development, CI pipelines, and future orchestration environments.
A simple implementation can use curl to check the root endpoint or a dedicated /health endpoint if one is added later.
Example:
dockerfile
HEALTHCHECK --interval=30s --timeout=3s --retries=3
CMD curl -f http://localhost:8080/ || exit 1
Acceptance Criteria
Dockerfile includes a working HEALTHCHECK instruction.
Running docker ps shows container status as healthy or unhealthy.
Healthcheck failures are visible in Docker logs.
The healthcheck works consistently in local development and CI.
Additional Notes
If the project later introduces a /health endpoint, the healthcheck command can be updated to target that route for more precise diagnostics.