fix: improve Dockerfile healthcheck, signal handling, and slim runtime#116
fix: improve Dockerfile healthcheck, signal handling, and slim runtime#116tac0turtle wants to merge 1 commit intomainfrom
Conversation
- Replace no-op `--version` healthcheck with actual RPC liveness probe - Add explicit STOPSIGNAL SIGTERM for proper graceful shutdown - Remove unnecessary build/debug packages from runtime image (libssl-dev, pkg-config, strace) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary of ChangesHello @tac0turtle, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enhances the Dockerfile for the Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
|
Claude finished @tac0turtle's task —— View job PR Review: Dockerfile ImprovementsTodo List:
Code Review SummaryThis PR makes three focused improvements to the Dockerfile that enhance operational reliability and reduce attack surface. Overall, these are solid improvements that follow Docker best practices. ✅ Excellent Changes1. Improved Healthcheck (Dockerfile:68-70)HEALTHCHECK --interval=30s --timeout=3s --start-period=60s --retries=3 \
CMD curl -sf http://localhost:8545/ -X POST -H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"eth_syncing","params":[],"id":1}' || exit 1✅ Excellent improvement!
2. Explicit Signal Handling (Dockerfile:72)STOPSIGNAL SIGTERM✅ Great addition!
3. Slimmed Runtime Image (Dockerfile:57)# Removed: libssl-dev pkg-config strace
apt-get install -y ca-certificates curl jq tini✅ Security improvement!
🔍 Technical AnalysisCode Quality: A
Security: A
Performance: A
Reliability: A
🔧 Minor Suggestions
HEALTHCHECK --interval=30s --timeout=3s --start-period=60s --retries=3 \
CMD curl -sf http://localhost:8545/ -X POST -H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"eth_syncing","params":[],"id":1}' | jq -e '.result != null' || exit 1This would verify the response is valid JSON, not just that curl succeeds.
❌ No Issues Found
Test Coverage AssessmentThe changes are infrastructure-level (Dockerfile) and don't require code test coverage. However:
Final Verdict: ✅ APPROVEDThis PR demonstrates excellent Docker practices and operational awareness. All changes are beneficial with no downsides. The improvements will make the containerized ev-reth more reliable in production environments. Recommended actions:
|
There was a problem hiding this comment.
Code Review
This pull request introduces several good improvements to the Dockerfile. It slims down the runtime image by removing unnecessary packages, improves the health check to be more robust by using a real RPC liveness probe, and sets STOPSIGNAL for graceful shutdown. My review includes a couple of suggestions to further enhance the Dockerfile: one to reduce the image size even more, and another to make the health check more reliable by validating the RPC response.
| CMD curl -sf http://localhost:8545/ -X POST -H "Content-Type: application/json" \ | ||
| -d '{"jsonrpc":"2.0","method":"eth_syncing","params":[],"id":1}' || exit 1 |
There was a problem hiding this comment.
The current healthcheck only verifies that curl exits successfully. However, a JSON-RPC server can return a successful HTTP status (200 OK) even if there's an error in the response payload (e.g., {"jsonrpc":"2.0","error":{...},"id":1}).
To make the healthcheck more robust, you can pipe the output to jq and verify that the response contains a result field, which indicates a successful RPC call. The jq utility is already installed in the image.
CMD curl -sf http://localhost:8545/ -X POST -H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"eth_syncing","params":[],"id":1}' | jq -e '.result != null'
Description
--versionhealthcheck with actual RPC liveness probe