From 63007472e40eeedb7f9de62dce003c530e79a85a Mon Sep 17 00:00:00 2001 From: Aaro Altonen Date: Sun, 21 Nov 2021 13:08:29 +0200 Subject: [PATCH] Add Dockerfile for mintlayer-core --- Dockerfile | 23 +++++++++++++++++++++++ docs/README.md | 15 +++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..9d24952 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,23 @@ +FROM debian:bullseye + +ENV REQUIRED_PACKAGES git clang curl libssl-dev llvm libudev-dev + +RUN apt-get update \ + && apt-get install -y $REQUIRED_PACKAGES \ + && curl https://sh.rustup.rs -sSf | sh -s -- -y \ + && $HOME/.cargo/bin/rustup default stable \ + && $HOME/.cargo/bin/rustup update \ + && $HOME/.cargo/bin/rustup update nightly \ + && $HOME/.cargo/bin/rustup target add wasm32-unknown-unknown --toolchain nightly + +RUN apt-get update \ + && apt-get install -y clang-9 \ + && git clone https://github.com/mintlayer/core \ + && cd core \ + && $HOME/.cargo/bin/cargo build --release + +WORKDIR /core + +EXPOSE 30333 + +CMD RUST_LOG=info target/release/mintlayer-core --base-path /tmp/ml-core --chain=assets/Testnet1Spec.json diff --git a/docs/README.md b/docs/README.md index 20ee934..dc2b9b1 100644 --- a/docs/README.md +++ b/docs/README.md @@ -113,6 +113,21 @@ Let's look at these flags in detail: | `--node-key ` | The Ed25519 secret key to use for `libp2p` networking. The value is parsed as a hex-encoded Ed25519 32 byte secret key, i.e. 64 hex characters. WARNING: Secrets provided as command-line arguments are easily exposed. Use of this option should be limited to development and testing. | | `--telemetry-url` | Tells the node to send telemetry data to a particular server. The one we've chosen here is hosted by Parity and is available for anyone to use. You may also host your own (beyond the scope of this article) or omit this flag entirely. | | `--validator` | Means that we want to participate in block production and finalization rather than just sync the network. | + +## Docker setup + +Alternatively, Docker can be used to launch a Mintlayer node. In the root directory, run: + +``` +docker build -t mintlayer-core . +docker run -t mintlayer-core +``` + +If you want to save the blockchain to host, run: +``` +docker run -v ~/ml-blockchain:/tmp/ml-core -t mintlayer-core +``` + ## Create a chain specification In the preceding example, we used `--chain local` which is a predefined "chain spec" that has Alice and Bob specified as validators along with many other useful defaults.