forked from base/benchmark
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
70 lines (57 loc) · 2.03 KB
/
Dockerfile
File metadata and controls
70 lines (57 loc) · 2.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# Stage 1: Base with system dependencies, Rust, and source code
FROM ubuntu:22.04 AS base
ENV DEBIAN_FRONTEND=noninteractive
ENV PATH="/root/.cargo/bin:${PATH}"
# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
curl \
git \
make \
cmake \
pkg-config \
libssl-dev \
libpq-dev \
libclang-dev \
ca-certificates \
sudo \
&& rm -rf /var/lib/apt/lists/*
# Install Rust
RUN curl https://sh.rustup.rs -sSf | bash -s -- -y
# Install Go
# Install Go manually using curl
RUN curl -fsSL https://go.dev/dl/go1.23.0.linux-amd64.tar.gz | tar -C /usr/local -xz
ENV PATH="/usr/local/go/bin:$PATH"
# Clone all source repos
WORKDIR /opt
RUN git clone https://github.com/paradigmxyz/reth.git && \
git clone https://github.com/ethereum-optimism/op-geth.git && \
git clone https://github.com/base/benchmark.git
RUN git -C reth checkout --force 9d56da53ec0ad60e229456a0c70b338501d923a5 && \
git -C op-geth checkout --force 4bc345b22fbee14d3162becd197373a9565b7c6d
# Stage 2: Build reth
FROM base AS build-reth
WORKDIR /opt/reth
RUN cargo build --features asm-keccak --profile release --bin op-reth --manifest-path crates/optimism/bin/Cargo.toml
# Stage 3: Build geth
FROM base AS build-geth
WORKDIR /opt/op-geth
RUN make geth
# Stage 4: Build benchmark
FROM base AS build-benchmark
WORKDIR /opt/benchmark
RUN make build
# Stage 5: Final minimal runtime image
FROM ubuntu:22.04 AS runtime
# Install minimal runtime dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates && \
rm -rf /var/lib/apt/lists/*
# Copy binaries from build stages
COPY --from=build-benchmark /opt/benchmark /opt/benchmark
COPY --from=build-benchmark /opt/benchmark/bin/base-bench /usr/local/bin/base-bench
COPY --from=build-reth /opt/reth/target/release/op-reth /usr/local/bin/reth
COPY --from=build-geth /opt/op-geth/build/bin/geth /usr/local/bin/geth
# Set working directory and default command
WORKDIR /opt/benchmark
ENTRYPOINT ["base-bench"]