-
Notifications
You must be signed in to change notification settings - Fork 54
/
Dockerfile
135 lines (113 loc) · 5.15 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# NEO private network - Dockerfile
FROM microsoft/dotnet:2.1.4-runtime-bionic
LABEL maintainer="City of Zion"
LABEL authors="metachris, ashant, hal0x2328, phetter"
ENV DEBIAN_FRONTEND noninteractive
# Disable dotnet usage information collection
# https://docs.microsoft.com/en-us/dotnet/core/tools/telemetry#behavior
ENV DOTNET_CLI_TELEMETRY_OPTOUT 1
# Install system dependencies. always should be done in one line
# https://docs.docker.com/engine/userguide/eng-image/dockerfile_best-practices/#run
RUN apt-get update && apt-get install -y \
unzip \
screen \
expect \
libleveldb-dev \
git-core \
wget \
curl \
git-core \
python3.6 \
python3.6-dev \
python3.6-venv \
python3-pip \
libleveldb-dev \
libssl-dev \
vim \
man \
libunwind8
# APT cleanup to reduce image size
RUN rm -rf /var/lib/apt/lists/*
# neo-python setup: clonse and install dependencies
RUN git clone https://github.com/CityOfZion/neo-python.git /neo-python
WORKDIR /neo-python
# RUN git checkout development
RUN pip3 install -e .
RUN wget https://s3.amazonaws.com/neo-experiments/neo-privnet.wallet
# Add the neo-cli package
ADD ./neo-cli.zip /opt/neo-cli.zip
ADD ./SimplePolicy.zip /opt/SimplePolicy.zip
ADD ./ApplicationLogs.zip /opt/ApplicationLogs.zip
# Extract and prepare four consensus nodes
RUN unzip -q -d /opt/node1 /opt/neo-cli.zip
RUN unzip -q -d /opt/node2 /opt/neo-cli.zip
RUN unzip -q -d /opt/node3 /opt/neo-cli.zip
RUN unzip -q -d /opt/node4 /opt/neo-cli.zip
# Extract and prepare SimplePolicy plugin
RUN unzip -q -d /opt/node1/neo-cli /opt/SimplePolicy.zip
RUN unzip -q -d /opt/node2/neo-cli /opt/SimplePolicy.zip
RUN unzip -q -d /opt/node3/neo-cli /opt/SimplePolicy.zip
RUN unzip -q -d /opt/node4/neo-cli /opt/SimplePolicy.zip
# Extract and prepare SimplePolicy plugin
RUN unzip -q -d /opt/node1/neo-cli /opt/ApplicationLogs.zip
RUN unzip -q -d /opt/node2/neo-cli /opt/ApplicationLogs.zip
RUN unzip -q -d /opt/node3/neo-cli /opt/ApplicationLogs.zip
RUN unzip -q -d /opt/node4/neo-cli /opt/ApplicationLogs.zip
# Remove zip neo-cli package
RUN rm /opt/neo-cli.zip
RUN rm /opt/SimplePolicy.zip
RUN rm /opt/ApplicationLogs.zip
# Create chain data directories
RUN mkdir -p /opt/chaindata/node1
RUN mkdir -p /opt/chaindata/node2
RUN mkdir -p /opt/chaindata/node3
RUN mkdir -p /opt/chaindata/node4
# Add config files
ADD ./configs/config1.json /opt/node1/neo-cli/config.json
ADD ./configs/config1.json /opt/node1/neo-cli/config.orig.json
ADD ./configs/protocol.json /opt/node1/neo-cli/protocol.json
ADD ./wallets/wallet1.json /opt/node1/neo-cli/
ADD ./configs/config-applicationlogs1.json /opt/node1/neo-cli/Plugins/ApplicationLogs/config.json
ADD ./configs/config-applicationlogs1.json /opt/node1/neo-cli/Plugins/ApplicationLogs/config.orig.json
ADD ./configs/config2.json /opt/node2/neo-cli/config.json
ADD ./configs/config2.json /opt/node2/neo-cli/config.orig.json
ADD ./configs/protocol.json /opt/node2/neo-cli/protocol.json
ADD ./wallets/wallet2.json /opt/node2/neo-cli/
ADD ./configs/config-applicationlogs2.json /opt/node2/neo-cli/Plugins/ApplicationLogs/config.json
ADD ./configs/config-applicationlogs2.json /opt/node2/neo-cli/Plugins/ApplicationLogs/config.orig.json
ADD ./configs/config3.json /opt/node3/neo-cli/config.json
ADD ./configs/config3.json /opt/node3/neo-cli/config.orig.json
ADD ./configs/protocol.json /opt/node3/neo-cli/protocol.json
ADD ./wallets/wallet3.json /opt/node3/neo-cli/
ADD ./configs/config-applicationlogs3.json /opt/node3/neo-cli/Plugins/ApplicationLogs/config.json
ADD ./configs/config-applicationlogs3.json /opt/node3/neo-cli/Plugins/ApplicationLogs/config.orig.json
ADD ./configs/config4.json /opt/node4/neo-cli/config.json
ADD ./configs/config4.json /opt/node4/neo-cli/config.orig.json
ADD ./configs/protocol.json /opt/node4/neo-cli/protocol.json
ADD ./wallets/wallet4.json /opt/node4/neo-cli/
ADD ./configs/config-applicationlogs4.json /opt/node4/neo-cli/Plugins/ApplicationLogs/config.json
ADD ./configs/config-applicationlogs4.json /opt/node4/neo-cli/Plugins/ApplicationLogs/config.orig.json
# Add scripts
ADD ./scripts/run.sh /opt/
ADD ./scripts/run_datadir_wrapper.sh /opt/
ADD ./scripts/start_consensus_node.sh /opt/
ADD ./scripts/claim_neo_and_gas_fixedwallet.py /neo-python/
ADD ./scripts/claim_gas_fixedwallet.py /neo-python/
ADD ./wallets/neo-privnet.python-wallet /tmp/wallet
# Some .bashrc helpers: 'neopy', and a welcome message for bash users
RUN echo "alias neopy=\"cd /neo-python && np-prompt -p\"" >> /root/.bashrc
RUN echo "printf \"\n* Consensus nodes are running in screen sessions, check 'screen -ls'\"" >> /root/.bashrc
RUN echo "printf \"\n* neo-python is installed in /neo-python, with a neo-privnet.wallet file in place\"" >> /root/.bashrc
RUN echo "printf \"\n* You can use the alias 'neopy' in the shell to start neo-python's prompt.py with privnet settings\"" >> /root/.bashrc
RUN echo "printf \"\n* Please report issues to https://github.com/CityOfZion/neo-privatenet-docker\n\n\"" >> /root/.bashrc
# Inform Docker what ports to expose
EXPOSE 20333
EXPOSE 20334
EXPOSE 20335
EXPOSE 20336
EXPOSE 30333
EXPOSE 30334
EXPOSE 30335
EXPOSE 30336
# On docker run, start the consensus nodes
CMD ["/bin/bash", "/opt/run_datadir_wrapper.sh"]