Skip to content

Commit

Permalink
pull and use gwynethtaiko/rbuilder
Browse files Browse the repository at this point in the history
  • Loading branch information
Keszey Dániel authored and Keszey Dániel committed Oct 25, 2024
1 parent 0b0cdda commit f01de37
Showing 1 changed file with 18 additions and 23 deletions.
41 changes: 18 additions & 23 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Use the latest Rust image for building reth
FROM lukemathwalker/cargo-chef:latest-rust-1 AS chef
WORKDIR /app
LABEL org.opencontainers.image.source=https://github.com/paradigmxyz/reth
Expand All @@ -6,7 +7,7 @@ LABEL org.opencontainers.image.licenses="MIT OR Apache-2.0"
# Install system dependencies
RUN apt-get update && apt-get -y upgrade && apt-get install -y libclang-dev pkg-config git

# Builds a cargo-chef plan
# Build a cargo-chef plan
FROM chef AS planner
COPY . .
RUN cargo chef prepare --recipe-path recipe.json
Expand All @@ -28,52 +29,46 @@ ENV FEATURES $FEATURES

# Builds dependencies
RUN cargo chef cook --profile $BUILD_PROFILE --features "$FEATURES" --recipe-path recipe.json
# Build application

# Build reth application
COPY . .
RUN cargo build --profile $BUILD_PROFILE --features "$FEATURES" --locked --bin reth

# Hack: Add a cache busting step (above steps are the more
# time consuming ones but we need to make sure the rbuilder is
# always freshly cloned and not cached !)
# Since the content of this file will change
# with each build, Docker will consider this
# layer (and all subsequent layers) as modified,
# forcing a re-execution of the following steps.
# ADD https://worldtimeapi.org/api/ip /tmp/bustcache

# Clone and build rbuilder (gwyneth branch)
# Clone rbuilder repository to access its config files
RUN git clone -b gwyneth https://github.com/taikoxyz/rbuilder.git /app/rbuilder
WORKDIR /app/rbuilder
RUN cargo build --release

# Copy binaries to a temporary location
# Copy reth binary to a temporary location
RUN cp /app/target/$BUILD_PROFILE/reth /app/reth
RUN cp /app/rbuilder/target/release/rbuilder /app/rbuilder

# Use Ubuntu as the release image
# Use Ubuntu as the final runtime image
FROM ubuntu:22.04 AS runtime
WORKDIR /app

# Install necessary runtime dependencies and Rust/Cargo
# Install necessary runtime dependencies
RUN apt-get update && apt-get install -y ca-certificates && rm -rf /var/lib/apt/lists/*

# Install Rust and Cargo
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
ENV PATH="/root/.cargo/bin:${PATH}"

# Copy reth and rbuilder binaries over from the build stage
# Copy reth binary from the build stage
COPY --from=builder /app/reth /usr/local/bin
COPY --from=builder /app/rbuilder /usr/local/bin

# Copy the entire rbuilder repository
# Copy rbuilder binary from the published Docker Hub image
COPY --from=gwynethtaiko/rbuilder:latest /usr/local/bin/rbuilder /usr/local/bin/rbuilder

# Copy rbuilder repository (configs, etc.) from the build stage
COPY --from=builder /app/rbuilder /app/rbuilder

# Copy licenses
COPY LICENSE-* ./

# Create start script
# Create start script for rbuilder
RUN echo '#!/bin/bash\nrbuilder run /app/rbuilder/config-gwyneth-reth.toml' > /app/start_rbuilder.sh && \
chmod +x /app/start_rbuilder.sh

# Expose necessary ports
EXPOSE 30303 30303/udp 9001 8545 8546
ENTRYPOINT ["/usr/local/bin/reth"]

# Set reth as the entrypoint
ENTRYPOINT ["/usr/local/bin/reth"]

0 comments on commit f01de37

Please sign in to comment.