Skip to content

Commit

Permalink
clients/reth: Dockerfile support to build Reth from git or locally (#860
Browse files Browse the repository at this point in the history
)
  • Loading branch information
spencer-tb authored Sep 14, 2023
1 parent da792c2 commit ce4be72
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 0 deletions.
40 changes: 40 additions & 0 deletions clients/reth/Dockerfile.git
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@

### Build Reth From Git:
## Pulls reth from a git repository and builds it from source.

## Builder stage: Compiles reth from a git repository
FROM rust:latest as builder

ARG github=paradigmxyz/reth
ARG tag=main

RUN apt-get update && apt-get install -y libclang-dev pkg-config build-essential \
&& echo "Cloning: $github - $tag" \
&& git clone --depth 1 --branch $tag https://github.com/$github reth \
&& cd reth && cargo build --release \
&& cp target/release/reth /usr/local/bin/reth

## Final stage: Sets up the environment for running reth
FROM debian:latest
RUN apt-get update && apt-get install -y bash curl jq \
&& apt-get clean && rm -rf /var/lib/apt/lists/*

# Copy compiled binary from builder
COPY --from=builder /usr/local/bin/reth /usr/local/bin/reth

# Add genesis mapper script, startup script, and enode URL retriever script
COPY genesis.json /genesis.json
COPY mapper.jq /mapper.jq
COPY reth.sh /reth.sh
COPY enode.sh /hive-bin/enode.sh

# Set execute permissions for scripts
RUN chmod +x /reth.sh /hive-bin/enode.sh

# Create version.txt
RUN /usr/local/bin/reth --version | head -1 > /version.txt

# Export the usual networking ports
EXPOSE 8545 8546 30303 30303/udp

ENTRYPOINT ["/reth.sh"]
38 changes: 38 additions & 0 deletions clients/reth/Dockerfile.local
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
### Build Reth Locally:
## Requires a copy of <reth>/ -> hive/clients/reth/<reth>

## Builder stage: Compiles reth from a git repository
FROM rust:latest as builder

# Default local client path: clients/reth/<reth>
ARG local_path=reth
COPY $local_path reth

RUN apt-get update && apt-get install -y libclang-dev pkg-config build-essential \
&& cd reth && cargo build --release \
&& cp target/release/reth /usr/local/bin/reth

## Final stage: Sets up the environment for running reth
FROM debian:latest
RUN apt-get update && apt-get install -y bash curl jq \
&& apt-get clean && rm -rf /var/lib/apt/lists/*

# Copy compiled binary from builder
COPY --from=builder /usr/local/bin/reth /usr/local/bin/reth

# Add genesis mapper script, startup script, and enode URL retriever script
COPY genesis.json /genesis.json
COPY mapper.jq /mapper.jq
COPY reth.sh /reth.sh
COPY enode.sh /hive-bin/enode.sh

# Set execute permissions for scripts
RUN chmod +x /reth.sh /hive-bin/enode.sh

# Create version.txt
RUN /usr/local/bin/reth --version | head -1 > /version.txt

# Export the usual networking ports
EXPOSE 8545 8546 30303 30303/udp

ENTRYPOINT ["/reth.sh"]

0 comments on commit ce4be72

Please sign in to comment.