Skip to content

Commit

Permalink
Adds Docker image to the template (#69)
Browse files Browse the repository at this point in the history
  • Loading branch information
crystalin authored Jul 8, 2020
1 parent b4c5ff2 commit 9962c79
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 0 deletions.
2 changes: 2 additions & 0 deletions template/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
**/target/
Dockerfile
36 changes: 36 additions & 0 deletions template/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
16 changes: 16 additions & 0 deletions template/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`).
Expand Down

0 comments on commit 9962c79

Please sign in to comment.