ci: set RUSTFLAGS in Dockerfile instead of bake (#21790)

This commit is contained in:
Alexey Shekhirin
2026-02-04 11:40:32 +00:00
committed by GitHub
parent 4ae60f3302
commit 819d6b6e02
3 changed files with 45 additions and 43 deletions

View File

@@ -100,7 +100,5 @@ jobs:
targets: ${{ steps.params.outputs.targets }}
push: ${{ !(github.event_name == 'workflow_dispatch' && inputs.dry_run) }}
set: |
ethereum-amd64.tags=${{ steps.params.outputs.ethereum_tags }}
ethereum-arm64.tags=${{ steps.params.outputs.ethereum_tags }}
optimism-amd64.tags=${{ steps.params.outputs.optimism_tags }}
optimism-arm64.tags=${{ steps.params.outputs.optimism_tags }}
ethereum.tags=${{ steps.params.outputs.ethereum_tags }}
optimism.tags=${{ steps.params.outputs.optimism_tags }}

View File

@@ -29,9 +29,8 @@ ARG MANIFEST_PATH=bin/reth
ARG BUILD_PROFILE=release
ENV BUILD_PROFILE=$BUILD_PROFILE
# Extra Cargo flags
# Extra Cargo flags (can be overridden, otherwise set per-platform below)
ARG RUSTFLAGS=""
ENV RUSTFLAGS="$RUSTFLAGS"
# Extra Cargo features
ARG FEATURES=""
@@ -46,11 +45,18 @@ ENV VERGEN_GIT_DESCRIBE=$VERGEN_GIT_DESCRIBE
ENV VERGEN_GIT_DIRTY=$VERGEN_GIT_DIRTY
# Build application
# Platform-specific RUSTFLAGS: amd64 uses x86-64-v3 (Haswell+) with pclmulqdq for rocksdb
ARG TARGETPLATFORM
COPY --exclude=.git . .
RUN --mount=type=secret,id=DEPOT_TOKEN,env=SCCACHE_WEBDAV_TOKEN \
--mount=type=cache,target=/usr/local/cargo/registry,sharing=shared \
--mount=type=cache,target=/usr/local/cargo/git,sharing=shared \
--mount=type=cache,target=$SCCACHE_DIR,sharing=shared \
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 $BINARY --manifest-path $MANIFEST_PATH/Cargo.toml
RUN sccache --show-stats || true

View File

@@ -32,22 +32,31 @@ variable "VERGEN_GIT_DIRTY" {
// Common settings for all targets
group "default" {
targets = [
"ethereum-amd64",
"ethereum-arm64",
"optimism-amd64",
"optimism-arm64"
"ethereum",
"optimism"
]
}
group "ethereum" {
targets = [
"ethereum"
]
}
group "optimism" {
targets = [
"optimism"
]
}
group "nightly" {
targets = [
"ethereum-amd64",
"ethereum-arm64",
"ethereum",
"ethereum-profiling",
"ethereum-edge-profiling",
"optimism-amd64",
"optimism-arm64",
"optimism-profiling"
"optimism",
"optimism-profiling",
"optimism-edge-profiling"
]
}
@@ -90,20 +99,13 @@ target "_base_arm64" {
target "_base_profiling" {
inherits = ["_base_amd64"]
platforms = ["linux/amd64"]
}
// Ethereum (reth)
target "ethereum-amd64" {
inherits = ["_base_amd64"]
args = {
BINARY = "reth"
MANIFEST_PATH = "bin/reth"
}
tags = ["${REGISTRY}/reth:${TAG}"]
}
target "ethereum-arm64" {
inherits = ["_base_arm64"]
// Ethereum (reth) - multi-platform
target "ethereum" {
inherits = ["_base"]
platforms = ["linux/amd64", "linux/arm64"]
args = {
BINARY = "reth"
MANIFEST_PATH = "bin/reth"
@@ -112,7 +114,8 @@ target "ethereum-arm64" {
}
target "ethereum-profiling" {
inherits = ["_base_profiling"]
inherits = ["_base_profiling"]
platforms = ["linux/amd64"]
args = {
BINARY = "reth"
MANIFEST_PATH = "bin/reth"
@@ -123,7 +126,8 @@ target "ethereum-profiling" {
}
target "ethereum-edge-profiling" {
inherits = ["_base_profiling"]
inherits = ["_base_profiling"]
platforms = ["linux/amd64"]
args = {
BINARY = "reth"
MANIFEST_PATH = "bin/reth"
@@ -133,18 +137,10 @@ target "ethereum-edge-profiling" {
tags = ["${REGISTRY}/reth:nightly-edge-profiling"]
}
// Optimism (op-reth)
target "optimism-amd64" {
inherits = ["_base_amd64"]
args = {
BINARY = "op-reth"
MANIFEST_PATH = "crates/optimism/bin"
}
tags = ["${REGISTRY}/op-reth:${TAG}"]
}
target "optimism-arm64" {
inherits = ["_base_arm64"]
// Optimism (op-reth) - multi-platform
target "optimism" {
inherits = ["_base"]
platforms = ["linux/amd64", "linux/arm64"]
args = {
BINARY = "op-reth"
MANIFEST_PATH = "crates/optimism/bin"
@@ -153,7 +149,8 @@ target "optimism-arm64" {
}
target "optimism-profiling" {
inherits = ["_base_profiling"]
inherits = ["_base_profiling"]
platforms = ["linux/amd64"]
args = {
BINARY = "op-reth"
MANIFEST_PATH = "crates/optimism/bin"
@@ -164,7 +161,8 @@ target "optimism-profiling" {
}
target "optimism-edge-profiling" {
inherits = ["_base_profiling"]
inherits = ["_base_profiling"]
platforms = ["linux/amd64"]
args = {
BINARY = "op-reth"
MANIFEST_PATH = "crates/optimism/bin"