Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 && \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

To further reduce the image size, it's a good practice to use the --no-install-recommends flag with apt-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.

    apt-get install -y --no-install-recommends ca-certificates curl jq tini && \

rm -rf /var/lib/apt/lists/*

WORKDIR /app
Expand All @@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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.

HEALTHCHECK --interval=30s --timeout=3s --start-period=60s --retries=3 \
    CMD curl -f -X POST --data '{"jsonrpc":"2.0","method":"eth_syncing","params":[],"id":1}' -H "Content-Type: application/json" http://localhost:8545 || exit 1


STOPSIGNAL SIGINT

ENTRYPOINT ["/usr/bin/tini", "--", "/usr/local/bin/ev-reth"]