Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
jasl committed Jun 14, 2022
1 parent eb30280 commit 6b44a6a
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 6 deletions.
10 changes: 5 additions & 5 deletions dockerfile.d/start_node.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
"")
Expand All @@ -22,16 +22,16 @@ 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")
PARACHAIN_ROLE_ARGS="--collator --rpc-external --rpc-methods Unsafe"
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}"
Expand Down
2 changes: 1 addition & 1 deletion node.Dockerfile
Original file line number Diff line number Diff line change
@@ -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'

Expand Down
60 changes: 60 additions & 0 deletions phala-node.Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]

0 comments on commit 6b44a6a

Please sign in to comment.