-
Notifications
You must be signed in to change notification settings - Fork 8
fix: improve Dockerfile signal handling and slim runtime #117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -54,7 +54,7 @@ RUN cp /app/target/$BUILD_PROFILE/ev-reth /ev-reth | |
| FROM ubuntu:24.04 AS runtime | ||
|
|
||
| RUN apt-get update && \ | ||
| apt-get install -y ca-certificates curl jq libssl-dev pkg-config strace tini && \ | ||
| apt-get install -y ca-certificates curl jq tini && \ | ||
| rm -rf /var/lib/apt/lists/* | ||
|
|
||
| WORKDIR /app | ||
|
|
@@ -65,8 +65,9 @@ COPY LICENSE-* ./ | |
| # Expose ports: P2P, Discovery, Metrics, JSON-RPC, WebSocket, GraphQL, Engine API | ||
| EXPOSE 30303 30303/udp 9001 8545 8546 7545 8551 | ||
|
|
||
| # Add health check | ||
| HEALTHCHECK --interval=30s --timeout=3s --start-period=40s --retries=3 \ | ||
| HEALTHCHECK --interval=30s --timeout=3s --start-period=60s --retries=3 \ | ||
| CMD /usr/local/bin/ev-reth --version || exit 1 | ||
|
Comment on lines
+68
to
69
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The current healthcheck command only verifies that the binary is executable, not that the node service is actually running and healthy. This could lead to a situation where the container is considered healthy even if the node has crashed or is unresponsive. A more effective healthcheck would query a live service endpoint, such as the JSON-RPC API, to confirm the service is responsive. |
||
|
|
||
| STOPSIGNAL SIGINT | ||
|
|
||
| ENTRYPOINT ["/usr/bin/tini", "--", "/usr/local/bin/ev-reth"] | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To further reduce the image size, it's a good practice to use the
--no-install-recommendsflag withapt-get install. This prevents the installation of packages that are not strictly required for the main packages to run, contributing to a slimmer runtime image.