forked from paradigmxyz/reth
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: make docker builds faster with cargo-chef (paradigmxyz#1432)
- Loading branch information
Showing
5 changed files
with
50 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,34 @@ | ||
# Use rust image as the builder base | ||
FROM rust:1.66.0-bullseye AS builder | ||
FROM lukemathwalker/cargo-chef:latest-rust-1 AS chef | ||
WORKDIR app | ||
|
||
# Builds a cargo-chef plan | ||
FROM chef AS planner | ||
COPY . . | ||
RUN cargo chef prepare --recipe-path recipe.json | ||
|
||
FROM chef AS builder | ||
COPY --from=planner /app/recipe.json recipe.json | ||
|
||
# Set the build profile to be release | ||
ARG BUILD_PROFILE=release | ||
ENV BUILD_PROFILE $BUILD_PROFILE | ||
|
||
# Update and install dependencies | ||
# Install system dependencies | ||
RUN apt-get update && apt-get -y upgrade && apt-get install -y libclang-dev pkg-config | ||
|
||
# Copy base folder into docker context | ||
COPY . reth | ||
# Builds dependencies | ||
RUN cargo chef cook --profile $BUILD_PROFILE --recipe-path recipe.json | ||
|
||
# Build reth | ||
RUN cd reth && cargo build --all --locked --profile $BUILD_PROFILE | ||
# Build application | ||
COPY . . | ||
RUN cargo build --profile $BUILD_PROFILE --locked --bin reth | ||
|
||
# Use Ubuntu as the release image | ||
FROM ubuntu | ||
FROM ubuntu AS runtime | ||
WORKDIR app | ||
|
||
# Copy the built reth binary from the previous stage | ||
COPY --from=builder /reth/target/release/reth /usr/local/bin/reth | ||
# Copy reth over from the build stage | ||
COPY --from=builder /app/target/release/reth /usr/local/bin | ||
|
||
CMD ["/usr/local/bin/reth"] | ||
EXPOSE 30303 30303/udp 9000 8545 8546 | ||
ENTRYPOINT ["/usr/local/bin/reth", "node"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,61 +1,30 @@ | ||
## Installation | ||
|
||
To use Reth, you must first install Geth. You can find instructions for installing Geth at the following link: [https://geth.ethereum.org/docs/install-and-build/installing-geth](https://geth.ethereum.org/docs/getting-started/installing-geth). | ||
reth is currently unstable and does not have officially cut releases. To install reth, you must either install it from source or using Docker. | ||
|
||
### Ubuntu | ||
Building the source | ||
### From Source | ||
|
||
* install rustup | ||
```bash | ||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh | ||
``` | ||
To build from source, first install [Rust](https://rustup.rs). You also need some basic build tools for our C libraries: | ||
|
||
* install Requirements | ||
- libclang-dev | ||
- pkg-config | ||
- For Ubuntu: `apt-get install libclang-dev pkg-config` | ||
- For Arch: `pacman -S base-devel` | ||
- For macOS: `brew install llvm pkg-config` | ||
|
||
```bash | ||
apt install libclang-dev pkg-config | ||
``` | ||
* Build reth | ||
```bash | ||
Then clone the repository and build the binary: | ||
|
||
```console | ||
git clone https://github.com/paradigmxyz/reth | ||
cd reth | ||
cargo build --all | ||
./target/debug/reth | ||
cargo install --release --locked --path . --bin reth | ||
``` | ||
|
||
### MacOS | ||
The binary will now be in a platform specific folder, and should be accessible as `reth` via the command line. | ||
|
||
To install and build reth on macOS using Homebrew, you can use the following steps | ||
### Using Docker | ||
|
||
* Install rustup by running the following command in a terminal: | ||
```bash | ||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh | ||
``` | ||
Clone the repository and build the image: | ||
|
||
* Install the necessary requirements by running the following command: | ||
```bash | ||
brew install llvm pkg-config | ||
``` | ||
|
||
* Clone the reth repository and navigate to the directory: | ||
```bash | ||
```console | ||
git clone https://github.com/paradigmxyz/reth | ||
cd reth | ||
``` | ||
|
||
* Build reth using cargo: | ||
```bash | ||
cargo build --all | ||
``` | ||
|
||
* Run reth: | ||
```bash | ||
./target/debug/reth | ||
``` | ||
|
||
* Alternatively, you can use the following one-liner to install and build reth: | ||
```bash | ||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh && brew install llvm pkg-config && git clone https://github.com/paradigmxyz/reth && cd reth && cargo build --all && ./target/debug/reth | ||
docker build -t paradigmxyz/reth . | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
# Intruduction | ||
# Introduction | ||
|
||
Reth is a user-friendly, modular, fast, and efficient Ethereum full node implementation that is compatible with the [Engine API](https://github.com/ethereum/execution-apis/tree/main/src/engine). It allows users to connect to the Ethereum network and interact with the blockchain, including sending and receiving transactions and accessing smart contracts. Reth is built and maintained by [Paradigm](https://www.paradigm.xyz/) and is licensed under the Apache and MIT licenses. | ||
|
||
## Status | ||
|
||
The project is not ready for use. We hope to have full sync implemented sometime in January/February 2023, followed by optimizations. In the meantime, we're working on making sure every crate of the repository is well documented, abstracted and tested. | ||
The project is not ready for use. We hope to have full sync implemented sometime in January/February 2023, followed by optimizations. In the meantime, we're working on making sure every crate of the repository is well documented, abstracted and tested. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters