From 6b44a6a1d6e3d39a8b6f73ffd7b98122314483ce Mon Sep 17 00:00:00 2001 From: jasl Date: Wed, 15 Jun 2022 04:00:40 +0800 Subject: [PATCH] update --- dockerfile.d/start_node.sh | 10 +++---- node.Dockerfile | 2 +- phala-node.Dockerfile | 60 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 66 insertions(+), 6 deletions(-) create mode 100644 phala-node.Dockerfile diff --git a/dockerfile.d/start_node.sh b/dockerfile.d/start_node.sh index c726a5d..73f7971 100755 --- a/dockerfile.d/start_node.sh +++ b/dockerfile.d/start_node.sh @@ -8,8 +8,8 @@ NODE_ROLE="${NODE_ROLE:-""}" PARACHAIN_PORT="${PARACHAIN_PORT:-"30333"}" RELAYCHAIN_PORT="${RELAYCHAIN_PORT:-"30334"}" -PARACHAIN="khala" -RELAYCHAIN="kusama" +PARACHAIN="${PARACHAIN:-"khala"}" +RELAYCHAIN="${RELAYCHAIN:-"kusama"}" case ${NODE_ROLE} in "") @@ -22,7 +22,7 @@ case ${NODE_ROLE} in RELAYCHAIN_ROLE_ARGS="" ;; "ARCHIVE") - PARACHAIN_ROLE_ARGS="--pruning archive --db-cache 2048" + PARACHAIN_ROLE_ARGS="--pruning archive --rpc-external" RELAYCHAIN_ROLE_ARGS="" ;; "COLLATOR") @@ -30,8 +30,8 @@ case ${NODE_ROLE} in RELAYCHAIN_ROLE_ARGS="" ;; "MINER") - PARACHAIN_ROLE_ARGS="--pruning archive --rpc-external --rpc-methods Unsafe --db-cache 2048" - RELAYCHAIN_ROLE_ARGS="--pruning archive --rpc-external --rpc-methods Unsafe --db-cache 2048" + PARACHAIN_ROLE_ARGS="--pruning archive --rpc-external --rpc-methods Unsafe" + RELAYCHAIN_ROLE_ARGS="--pruning archive --rpc-external --rpc-methods Unsafe" ;; *) echo "Unknown NODE_ROLE ${NODE_ROLE}" diff --git a/node.Dockerfile b/node.Dockerfile index 4878dc7..2942815 100644 --- a/node.Dockerfile +++ b/node.Dockerfile @@ -1,7 +1,7 @@ FROM ubuntu:20.04 AS builder ARG DEBIAN_FRONTEND='noninteractive' -ARG RUST_TOOLCHAIN='nightly-2021-11-11' +ARG RUST_TOOLCHAIN='nightly-2022-04-01' ARG PHALA_GIT_REPO='https://github.com/Phala-Network/khala-parachain.git' ARG PHALA_GIT_TAG='master' diff --git a/phala-node.Dockerfile b/phala-node.Dockerfile new file mode 100644 index 0000000..394784c --- /dev/null +++ b/phala-node.Dockerfile @@ -0,0 +1,60 @@ +FROM ubuntu:20.04 AS builder + +ARG DEBIAN_FRONTEND='noninteractive' +ARG RUST_TOOLCHAIN='nightly-2022-04-01' +ARG PHALA_GIT_REPO='https://github.com/Phala-Network/khala-parachain.git' +ARG PHALA_GIT_TAG='master' + +WORKDIR /root + +RUN apt-get update && \ + apt-get install -y apt-utils apt-transport-https software-properties-common readline-common curl vim wget gnupg gnupg2 gnupg-agent ca-certificates cmake pkg-config libssl-dev git build-essential llvm clang libclang-dev + +RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain="${RUST_TOOLCHAIN}" && \ + $HOME/.cargo/bin/rustup target add wasm32-unknown-unknown --toolchain "${RUST_TOOLCHAIN}" + +RUN echo "Compiling Khala from $PHALA_GIT_REPO:$PHALA_GIT_TAG..." && \ + git clone --depth 1 --recurse-submodules --shallow-submodules -j 8 -b ${PHALA_GIT_TAG} ${PHALA_GIT_REPO} khala-parachain && \ + cd khala-parachain && \ + PATH="$HOME/.cargo/bin:$PATH" cargo build --profile production && \ + cp ./target/production/khala-node /root && \ + PATH="$HOME/.cargo/bin:$PATH" cargo clean && \ + rm -rf /root/.cargo/registry && \ + rm -rf /root/.cargo/git + +# ==== + +FROM ubuntu:20.04 + +ARG DEBIAN_FRONTEND='noninteractive' + +WORKDIR /root + +RUN apt-get update && \ + apt-get install -y apt-utils apt-transport-https software-properties-common readline-common curl vim wget gnupg gnupg2 gnupg-agent ca-certificates tini + +COPY --from=builder /root/khala-node /usr/local/bin/khala-node +ADD dockerfile.d/start_node.sh ./start_node.sh + +ENV RUST_LOG="info" +ENV NODE_NAME="phala-node" +ENV NODE_ROLE="ARCHIVE" + +ENV PARACHAIN="phala" +ENV RELAYCHAIN="polkadot" + +ENV PARACHAIN_EXTRA_ARGS="" +ENV RELAYCHAIN_EXTRA_ARGS="" + +EXPOSE 9615 +EXPOSE 9616 +EXPOSE 9933 +EXPOSE 9934 +EXPOSE 9944 +EXPOSE 9945 +EXPOSE 30333 +EXPOSE 30334 + +ENTRYPOINT ["/usr/bin/tini", "--"] + +CMD ["/bin/bash", "./start_node.sh"]