From 23d3db4ea56fc6b218180de56b37fa270f2550d3 Mon Sep 17 00:00:00 2001 From: Alexey Shekhirin Date: Mon, 27 Apr 2026 10:49:02 +0200 Subject: [PATCH 1/2] perf(docker): add platform-specific RUSTFLAGS to Dockerfile Set x86-64-v3 target CPU with pclmulqdq on amd64, matching Dockerfile.depot. --- Dockerfile | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index e41d3671b0a..aff9ff25366 100644 --- a/Dockerfile +++ b/Dockerfile @@ -33,8 +33,15 @@ ENV FEATURES=$FEATURES RUN cargo chef cook --profile $BUILD_PROFILE --features "$FEATURES" --recipe-path recipe.json # Build application +# Platform-specific RUSTFLAGS: amd64 uses x86-64-v3 (Haswell+) with pclmulqdq for rocksdb +ARG TARGETPLATFORM COPY --exclude=dist . . -RUN cargo build --profile $BUILD_PROFILE --features "$FEATURES" --locked --bin reth +RUN if [ -n "$RUSTFLAGS" ]; then \ + export RUSTFLAGS="$RUSTFLAGS"; \ + elif [ "$TARGETPLATFORM" = "linux/amd64" ]; then \ + export RUSTFLAGS="-C target-cpu=x86-64-v3 -C target-feature=+pclmulqdq"; \ + fi && \ + cargo build --profile $BUILD_PROFILE --features "$FEATURES" --locked --bin reth # ARG is not resolved in COPY so we have to hack around it by copying the # binary to a temporary location From f366acbc5be2eb35ce2e5675c885139759ea02c6 Mon Sep 17 00:00:00 2001 From: Alexey Shekhirin Date: Mon, 27 Apr 2026 11:01:52 +0200 Subject: [PATCH 2/2] add comment about buildkit arg --- Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Dockerfile b/Dockerfile index aff9ff25366..6e6c86c6eec 100644 --- a/Dockerfile +++ b/Dockerfile @@ -34,6 +34,8 @@ RUN cargo chef cook --profile $BUILD_PROFILE --features "$FEATURES" --recipe-pat # Build application # Platform-specific RUSTFLAGS: amd64 uses x86-64-v3 (Haswell+) with pclmulqdq for rocksdb +# +# TARGETPLATFORM is set by BuildKit: https://docs.docker.com/reference/dockerfile#automatic-platform-args-in-the-global-scope ARG TARGETPLATFORM COPY --exclude=dist . . RUN if [ -n "$RUSTFLAGS" ]; then \