Skip to content

chore: added Dockerfile's and minor changes to rustfmt.toml #251

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 19 commits into from
Apr 1, 2025
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 14 additions & 27 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,20 +1,8 @@
[workspace]
members = [
"bin/ream",
"crates/common/consensus",
"crates/common/execution_engine",
"crates/common/executor",
"crates/common/network_spec",
"crates/crypto/bls",
"crates/networking/discv5",
"crates/networking/p2p",
"crates/rpc",
"crates/runtime",
"crates/storage",
"testing/ef-tests",
]

default-members = ["bin/ream"]
members = ["bin/ream", "crates/common/consensus", "crates/common/execution_engine", "crates/common/executor", "crates/common/network_spec", "crates/crypto/bls", "crates/networking/discv5", "crates/networking/p2p", "crates/rpc", "crates/runtime", "crates/storage", "testing/ef-tests",
]
resolver = "2"

[workspace.package]
Expand All @@ -33,7 +21,6 @@ alloy-primitives = { version = "0.8", features = ['serde'] }
alloy-rlp = { version = "0.3.8", default-features = false, features = ["derive"] }
anyhow = "1.0"
async-trait = "0.1.86"
kzg = { git = "https://github.com/grandinetech/rust-kzg" }
clap = "4"
directories = { version = "6.0.0" }
discv5 = { version = "0.9.0", features = ["libp2p"] }
Expand All @@ -46,9 +33,20 @@ futures = "0.3"
hex = "0.4"
itertools = "0.14"
jsonwebtoken = "9.3.1"
kzg = { git = "https://github.com/grandinetech/rust-kzg" }
libp2p = { version = "0.54", default-features = false, features = ["identify", "yamux", "noise", "dns", "tcp", "tokio", "plaintext", "secp256k1", "macros", "ecdsa", "metrics", "quic", "upnp", "gossipsub", "ping"] }
libp2p-identity = "0.2"
libp2p-mplex = "0.42"
libp2p = { version = "0.54", default-features = false, features = ["identify", "yamux", "noise", "dns", "tcp", "tokio", "plaintext", "secp256k1", "macros", "ecdsa", "metrics", "quic", "upnp", "gossipsub", "ping"] }

# ream dependencies
ream-bls = { path = "crates/crypto/bls", features = ["zkcrypto"] } # Default feature is zkcrypto
ream-consensus = { path = "crates/common/consensus" }
ream-discv5 = { path = "crates/networking/discv5" }
ream-execution-engine = { path = "crates/common/execution_engine" }
ream-executor = { path = "crates/common/executor" }
ream-network-spec = { path = "crates/common/network_spec" }
ream-p2p = { path = "crates/networking/p2p" }
ream-storage = { path = "crates/storage" }
redb = { version = "2.4.0" }
reqwest = { version = "0.12", features = ["json"] }
rstest = "0.23"
Expand All @@ -65,16 +63,5 @@ tracing-subscriber = "0.3"
tree_hash = "0.9"
tree_hash_derive = "0.9"


# ream dependencies
ream-bls = { path = "crates/crypto/bls", features = ["zkcrypto"] } # Default feature is zkcrypto
ream-consensus = { path = "crates/common/consensus" }
ream-discv5 = { path = "crates/networking/discv5"}
ream-execution-engine = { path = "crates/common/execution_engine"}
ream-executor = { path = "crates/common/executor" }
ream-network-spec = { path = "crates/common/network_spec" }
ream-p2p = { path = "crates/networking/p2p" }
ream-storage = { path = "crates/storage"}

[patch.crates-io]
ethereum_hashing = { git = "https://github.com/ReamLabs/ethereum_hashing.git" }
71 changes: 54 additions & 17 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,55 @@
FROM rust:1.81.0-bullseye AS builder
RUN apt-get update && apt-get -y upgrade && apt-get install -y cmake libclang-dev
COPY . ream
ARG FEATURES
ARG PROFILE=release
ARG CARGO_USE_GIT_CLI=true
# syntax=docker.io/docker/dockerfile:1.7-labs

FROM lukemathwalker/cargo-chef:latest-rust-1 AS chef
WORKDIR /app

LABEL org.opencontainers.image.source=https://github.com/reamlabs/ream
LABEL org.opencontainers.image.description="Ream is a modular, open-source Ethereum beam chain client."
LABEL org.opencontainers.image.licenses="MIT"

# Install system dependencies
RUN apt-get update && apt-get -y upgrade && apt-get install -y libclang-dev pkg-config

# Builds a cargo-chef plan
FROM chef AS planner
COPY --exclude=.git --exclude=dist . .
RUN cargo chef prepare --recipe-path recipe.json

FROM chef AS builder
COPY --from=planner /app/recipe.json recipe.json

# Build profile, release by default
ARG BUILD_PROFILE=release
ENV BUILD_PROFILE=$BUILD_PROFILE

# Extra Cargo flags
ARG RUSTFLAGS=""
ENV RUSTFLAGS="$RUSTFLAGS"

# Extra Cargo features
ARG FEATURES=""
ENV FEATURES=$FEATURES
ENV PROFILE=$PROFILE
ENV CARGO_NET_GIT_FETCH_WITH_CLI=$CARGO_USE_GIT_CLI
RUN cd ream && make install

FROM ubuntu:22.04
RUN apt-get update && apt-get -y upgrade && apt-get install -y --no-install-recommends \
libssl-dev \
ca-certificates \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
COPY --from=builder /usr/local/cargo/bin/ream /usr/local/bin/ream

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

# Build application
COPY --exclude=.git --exclude=dist . .
RUN cargo build --profile $BUILD_PROFILE --features "$FEATURES" --locked --bin ream

# ARG is not resolved in COPY so we have to hack around it by copying the
# binary to a temporary location
RUN cp /app/target/$BUILD_PROFILE/ream /app/ream

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

# Copy reth over from the build stage
COPY --from=builder /app/ream /usr/local/bin

# Copy licenses
COPY LICENSE-* ./

EXPOSE 8545 8546
ENTRYPOINT ["/usr/local/bin/ream"]
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,6 @@ lint: # Run `clippy` and `rustfmt`.

# clippy for bls with supranational feature
cargo clippy --package ream-bls --all-targets --features "supranational" --no-deps -- --deny warnings

# cargo sort
cargo sort
38 changes: 38 additions & 0 deletions book/installation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Build from Source

You can build Ream on Linux.

## Dependencies

First install Rust using <a href="https://rustup.rs/">rustup</a>:

```bash
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
```

There are some other dependencies you need to install based on your operating system (OS):

- **Ubuntu/Debian**: `apt-get install libclang-dev pkg-config libssl-dev build-essential`



## Build Ream

Clone the repository and move to the directory:

```bash
git clone [email protected]:reamlabs/ream.git
cd ream
```

There are also some other rust tools that you need to install.

```bash
cargo install cargo-sort
```

After everything is setup, you can start the build:

```bash
make build // cargo build --release
```
2 changes: 0 additions & 2 deletions rust-toolchain.toml

This file was deleted.

3 changes: 3 additions & 0 deletions tomlfmt.toml
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
# cargo-sort configuration
## https://github.com/DevinR528/cargo-sort

key_value_newlines = true
Loading