11# ##
22# # docker image build \
33# # --file testchains/nethermind.dockerfile \
4- # # --tag nexus.iex.ec/poco-chain:native-vX.Y.Z-some-fork.0 \
4+ # # --tag nexus.iex.ec/poco-chain:native-vX.Y.Z-alpha.0 \
5+ # # --build-arg MNEMONIC="actual surround disorder swim upgrade devote digital misery truly verb slide final" \
56# # --build-arg CHAIN_TYPE=native \
6- # # --build-arg CHAIN_BLOCK_TIME=1 \
7+ # # --build-arg CHAIN_BLOCK_TIME=5 \
78# # --build-arg CHAIN_FORCE_SEALING=true \
89# # .
910# ##
10- FROM iexechub/nethermind:1.14.1-patch.0
11- USER root
11+
12+ FROM iexechub/nethermind:1.14.1-patch.0 AS builder
13+
1214RUN apt-get update && apt-get install bash jq nodejs npm -y
1315# Add git required to install ethereumjs-abi from github (https://github.com/MetaMask/web3-provider-engine/issues/345)
1416#
@@ -25,41 +27,39 @@ RUN echo -e "Node: `node -v` - npm: `npm -v`"
2527# ##
2628# Type of the blockchain to build.
2729# "native" or "token".
28- ARG CHAIN_TYPE
29- # New blocks creating interval in seconds.
30+ ARG CHAIN_TYPE=native
31+ RUN echo "CHAIN_TYPE: ${CHAIN_TYPE}"
32+ # New blocks creation interval in seconds.
3033# "1", "5", "20", ...
31- ARG CHAIN_BLOCK_TIME
34+ ARG CHAIN_BLOCK_TIME=5
35+ RUN echo "CHAIN_BLOCK_TIME: ${CHAIN_BLOCK_TIME}"
3236# Always create new blocks (even without txs).
3337# "true" or "false"
34- ARG CHAIN_FORCE_SEALING
38+ ARG CHAIN_FORCE_SEALING=true
39+ RUN echo "CHAIN_FORCE_SEALING: ${CHAIN_FORCE_SEALING}"
3540
3641# ##
37- # # Log build configuration .
42+ # # Copy chain config .
3843# ##
39- ENV MESSAGE="\n ##########\n "
40- ENV MESSAGE="${MESSAGE}### CHAIN_TYPE: ${CHAIN_TYPE} \n "
41- ENV MESSAGE="${MESSAGE}### CHAIN_BLOCK_TIME: ${CHAIN_BLOCK_TIME} \n "
42- ENV MESSAGE="${MESSAGE}### CHAIN_FORCE_SEALING: ${CHAIN_FORCE_SEALING} \n "
43- ENV MESSAGE="${MESSAGE}########## \n "
44- RUN echo -e ${MESSAGE}
44+ COPY testchains/nethermind/poco-chain.json /nethermind/chainspec/poco-chain.json
45+ COPY testchains/nethermind/poco-chain.cfg /nethermind/configs/poco-chain.cfg
46+ COPY testchains/nethermind/keystore /nethermind/keystore
47+ RUN sed -i "s/@stepDuration@/${CHAIN_BLOCK_TIME}/" /nethermind/chainspec/poco-chain.json
48+ RUN sed -i "s/@forceSealing@/${CHAIN_FORCE_SEALING}/" /nethermind/configs/poco-chain.cfg
49+ # Remove eip1559 for sidechains
50+ RUN if [ "${CHAIN_TYPE}" = "native" ] ; \
51+ then \
52+ sed -i "/eip1559/d" /nethermind/chainspec/poco-chain.json; \
53+ fi
4554
4655# ##
47- # # Copy files and setup the chain config.
56+ # # Copy PoCo contracts
4857# ##
49- ENV BASE_DIR="/iexec-poco/testchains/nethermind"
50- RUN mkdir /iexec-poco
5158COPY . /iexec-poco
52- COPY ./testchains/nethermind/keystore/key-c08c3def622af1476f2db0e3cc8ccaead07be3bb /nethermind/keystore/
5359RUN mv /iexec-poco/config/config_${CHAIN_TYPE}.json /iexec-poco/config/config.json
54- RUN sed -i "s/@stepDuration@/${CHAIN_BLOCK_TIME}/" ${BASE_DIR}/spec.json
55- RUN sed -i "s/@force_sealing@/${CHAIN_FORCE_SEALING}/" ${BASE_DIR}/authority.cfg
56- # remove eip1559 for sidechains
57- RUN if [ "${CHAIN_TYPE}" = "native" ] ; \
58- then \
59- sed -i "/eip1559/d" ${BASE_DIR}/spec.json; \
60- fi
60+
6161# ##
62- # # Run migration
62+ # # Deploy contracts
6363# ##
6464ARG DEV_NODE
6565ARG MNEMONIC
@@ -70,14 +70,19 @@ RUN echo "MNEMONIC: ${MNEMONIC}"
7070RUN if [ "${CHAIN_TYPE}" = "native" ] ; \
7171 then \
7272 echo "Migration file: ${BASE_DIR}/migrate.sh" ; \
73- bash ${BASE_DIR} /migrate.sh; \
73+ bash /iexec-poco/testchains/nethermind /migrate.sh; \
7474 else \
7575 echo "Migration file: ${BASE_DIR}/migrate-all.sh" ; \
76- bash ${BASE_DIR} /migrate-all.sh; \
76+ bash /iexec-poco/testchains/nethermind /migrate-all.sh; \
7777 fi
7878
79- # ###
79+ FROM iexechub/nethermind:1.14.1-patch.0
80+
81+ COPY --from=builder /nethermind /nethermind
82+ COPY --from=builder /iexec-poco/build /build
83+
84+ # ##
8085# # Configure entrypoint
8186# ##
82- ENTRYPOINT [ "../.. /nethermind/Nethermind.Runner" ]
83- CMD [ "--config=/iexec-poco/testchains/ nethermind/authority .cfg" ]
87+ ENTRYPOINT [ "/nethermind/Nethermind.Runner" ]
88+ CMD [ "--config=/nethermind/configs/poco-chain .cfg" ]
0 commit comments