From 517c52e704b746e5846882a639719acf195104dd Mon Sep 17 00:00:00 2001 From: dan moore Date: Wed, 27 Jul 2022 10:43:44 -0500 Subject: [PATCH] add dockerfile --- Dockerfile | 43 +++++++++++++++++++++++++++++++++++++++++++ entrypoint.sh | 25 +++++++++++++++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 Dockerfile create mode 100644 entrypoint.sh diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..9dbd8045e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,43 @@ +# Phase 0: Builder +# ========================= +FROM paritytech/ci-linux:production as builder + +RUN apt-get update && \ + apt-get install -y git openssh-client && \ + rm -rf /var/lib/apt/lists && \ + mkdir -p /avail + +COPY . /avail/ + +RUN \ + mkdir -p /da/bin && \ + mkdir -p /da/genesis && \ + # Build DA \ + cp -r /avail/misc/genesis /da && \ + cd /avail && \ + cargo build --release -p data-avail && \ + # Install binaries \ + mv target/release/data-avail /da/bin + + +# Phase 1: Binary deploy +# ========================= +FROM debian:buster-slim + +RUN apt-get update && \ + apt-get install -y curl && \ + rm -rf /var/lib/apt/lists + +COPY --from=builder /da/ /da +COPY entrypoint.sh / +WORKDIR /da + +ENV \ + DA_CHAIN="/da/genesis/testnet.chain.spec.raw.json" \ + DA_NAME="AvailNode" \ + DA_MAX_IN_PEERS=50 \ + DA_MAX_OUT_PEERS=50 \ + DA_P2P_PORT="30333" + +VOLUME ["/tmp", "/da/state", "/da/keystore"] +ENTRYPOINT ["/entrypoint.sh"] diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 000000000..c5311f3a1 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,25 @@ +#!/bin/sh +cat /entrypoint.sh; + +trap cleanup 1 2 3 6 + +cleanup() +{ + echo "Done cleanup ... quitting." + exit 1 +} + +/da/bin/data-avail \ + --validator \ + --base-path /da/state \ + --keystore-path /da/keystore \ + --execution=NativeElseWasm \ + --offchain-worker=Always \ + --enable-offchain-indexing=true \ + --name $DA_NAME \ + --chain $DA_CHAIN \ + --port $DA_P2P_PORT \ + --bootnodes=/ip4/52.47.205.129/tcp/30333/p2p/12D3KooW9tVuCzq3eknsevL5uyqQ3LpVcuqtkTqropjNccbhsWBz \ + --bootnodes=/ip4/15.237.127.118/tcp/30333/p2p/12D3KooWQtxig5HukFDwQzshGWgQEZAqGqdCN7AQBW7cQRJWCyxL \ + --bootnodes=/ip4/52.47.205.129/tcp/30333/p2p/12D3KooW9tVuCzq3eknsevL5uyqQ3LpVcuqtkTqropjNccbhsWBz \ + $@