Skip to content

Commit 80cdc29

Browse files
spencer-tbEikix
authored andcommitted
clients/reth: Dockerfile support to build Reth from git or locally (ethereum#860)
1 parent bd48a2b commit 80cdc29

File tree

2 files changed

+78
-0
lines changed

2 files changed

+78
-0
lines changed

clients/reth/Dockerfile.git

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
2+
### Build Reth From Git:
3+
## Pulls reth from a git repository and builds it from source.
4+
5+
## Builder stage: Compiles reth from a git repository
6+
FROM rust:latest as builder
7+
8+
ARG github=paradigmxyz/reth
9+
ARG tag=main
10+
11+
RUN apt-get update && apt-get install -y libclang-dev pkg-config build-essential \
12+
&& echo "Cloning: $github - $tag" \
13+
&& git clone --depth 1 --branch $tag https://github.com/$github reth \
14+
&& cd reth && cargo build --release \
15+
&& cp target/release/reth /usr/local/bin/reth
16+
17+
## Final stage: Sets up the environment for running reth
18+
FROM debian:latest
19+
RUN apt-get update && apt-get install -y bash curl jq \
20+
&& apt-get clean && rm -rf /var/lib/apt/lists/*
21+
22+
# Copy compiled binary from builder
23+
COPY --from=builder /usr/local/bin/reth /usr/local/bin/reth
24+
25+
# Add genesis mapper script, startup script, and enode URL retriever script
26+
COPY genesis.json /genesis.json
27+
COPY mapper.jq /mapper.jq
28+
COPY reth.sh /reth.sh
29+
COPY enode.sh /hive-bin/enode.sh
30+
31+
# Set execute permissions for scripts
32+
RUN chmod +x /reth.sh /hive-bin/enode.sh
33+
34+
# Create version.txt
35+
RUN /usr/local/bin/reth --version | head -1 > /version.txt
36+
37+
# Export the usual networking ports
38+
EXPOSE 8545 8546 30303 30303/udp
39+
40+
ENTRYPOINT ["/reth.sh"]

clients/reth/Dockerfile.local

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
### Build Reth Locally:
2+
## Requires a copy of <reth>/ -> hive/clients/reth/<reth>
3+
4+
## Builder stage: Compiles reth from a git repository
5+
FROM rust:latest as builder
6+
7+
# Default local client path: clients/reth/<reth>
8+
ARG local_path=reth
9+
COPY $local_path reth
10+
11+
RUN apt-get update && apt-get install -y libclang-dev pkg-config build-essential \
12+
&& cd reth && cargo build --release \
13+
&& cp target/release/reth /usr/local/bin/reth
14+
15+
## Final stage: Sets up the environment for running reth
16+
FROM debian:latest
17+
RUN apt-get update && apt-get install -y bash curl jq \
18+
&& apt-get clean && rm -rf /var/lib/apt/lists/*
19+
20+
# Copy compiled binary from builder
21+
COPY --from=builder /usr/local/bin/reth /usr/local/bin/reth
22+
23+
# Add genesis mapper script, startup script, and enode URL retriever script
24+
COPY genesis.json /genesis.json
25+
COPY mapper.jq /mapper.jq
26+
COPY reth.sh /reth.sh
27+
COPY enode.sh /hive-bin/enode.sh
28+
29+
# Set execute permissions for scripts
30+
RUN chmod +x /reth.sh /hive-bin/enode.sh
31+
32+
# Create version.txt
33+
RUN /usr/local/bin/reth --version | head -1 > /version.txt
34+
35+
# Export the usual networking ports
36+
EXPOSE 8545 8546 30303 30303/udp
37+
38+
ENTRYPOINT ["/reth.sh"]

0 commit comments

Comments
 (0)