diff --git a/template/.dockerignore b/template/.dockerignore new file mode 100644 index 000000000..ef206f908 --- /dev/null +++ b/template/.dockerignore @@ -0,0 +1,2 @@ +**/target/ +Dockerfile diff --git a/template/Dockerfile b/template/Dockerfile new file mode 100644 index 000000000..32e22feb4 --- /dev/null +++ b/template/Dockerfile @@ -0,0 +1,36 @@ +# Note: This is currently designed to simplify development +# To get a smaller docker image, there should be 2 images generated, in 2 stages. + +FROM rustlang/rust:nightly + + +ARG PROFILE=release +WORKDIR /frontier + +# Upcd dates core parts +RUN apt-get update -y && \ + apt-get install -y cmake pkg-config libssl-dev git gcc build-essential clang libclang-dev + +# Install rust wasm. Needed for substrate wasm engine +RUN rustup target add wasm32-unknown-unknown + +# Download Frontier repo +RUN git clone https://github.com/paritytech/frontier /frontier +RUN cd /frontier && git submodule init && git submodule update + +# Download rust dependencies and build the rust binary +RUN cargo build "--$PROFILE" + +# 30333 for p2p traffic +# 9933 for RPC call +# 9944 for Websocket +# 9615 for Prometheus (metrics) +EXPOSE 30333 9933 9944 9615 + + +ENV PROFILE ${PROFILE} + +# The execution will re-compile the project to run it +# This allows to modify the code and not have to re-compile the +# dependencies. +CMD cargo run "--$PROFILE" -- --dev diff --git a/template/README.md b/template/README.md index d970d377d..0368441bb 100644 --- a/template/README.md +++ b/template/README.md @@ -20,6 +20,22 @@ To execute the chain, run: $ ./target/debug/frontier-template-node --dev ``` +### Docker image + +You can run the frontier node (for development) within Docker directly. +The Dockerfile is optimized for development speed. +(Running the `docker run...` command will recompile the binaries but not the dependencies) + +Building (takes 5-10 min): +```bash +docker build -t frontier-node-dev . +``` + +Running (takes 1 min to rebuild binaries): +```bash +docker run -t frontier-node-dev +``` + ## Genesis Configuration The development [chain spec](/src/chain_spec.rs) included with this project defines a genesis block that has been pre-configured with an EVM account for [Alice](https://substrate.dev/docs/en/next/development/tools/subkey#well-known-keys). When [a development chain is started](https://github.com/substrate-developer-hub/substrate-node-template#run), Alice's EVM account will be funded with a large amount of Ether (`U256::MAX`).