@@ -18,6 +18,11 @@ COPY --from=planner /app/recipe.json recipe.json
1818ARG BUILD_PROFILE=release
1919ENV BUILD_PROFILE=$BUILD_PROFILE
2020
21+ # Build flags for profiling-friendly binaries.
22+ # Defaults enable call-stack unwinding and symbol data for better eBPF flamegraphs.
23+ ARG RUSTFLAGS="-C force-frame-pointers=yes -C debuginfo=1 -C symbol-mangling-version=v0"
24+ ENV RUSTFLAGS=$RUSTFLAGS
25+
2126# Builds dependencies with debug profile (faster linking, keeps symbols)
2227RUN cargo chef cook --profile $BUILD_PROFILE --recipe-path recipe.json
2328
@@ -31,9 +36,20 @@ RUN cp /app/target/release/bera-reth /app/bera-reth
3136# Use Ubuntu as the release image
3237FROM ubuntu:24.04 AS runtime
3338
34- # Install runtime dependencies
39+ # Install runtime dependencies and eBPF observability tooling.
40+ # Note: eBPF tooling requires extra container privileges at runtime
41+ # (for example: --privileged, or CAP_BPF + CAP_PERFMON + CAP_SYS_ADMIN,
42+ # and usually --pid=host with host /sys mounted).
3543RUN apt-get update && \
36- apt-get install -y ca-certificates libssl-dev && \
44+ apt-get install -y \
45+ ca-certificates \
46+ libssl-dev \
47+ linux-tools-common \
48+ bpftrace \
49+ bpfcc-tools \
50+ procps \
51+ psmisc \
52+ strace && \
3753 rm -rf /var/lib/apt/lists/*
3854
3955# Copy bera-reth over from the build stage
@@ -49,5 +65,6 @@ EXPOSE 30303 30303/udp 9001 8545 8546 8551
4965# Set environment to show we're in debug mode
5066ENV RUST_LOG=debug
5167ENV BUILD_TYPE=release
68+ ENV BPFTRACE_CACHE_USER_SYMBOLS=1
5269
5370ENTRYPOINT ["/usr/local/bin/bera-reth"]
0 commit comments