forked from steemit/steem
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
311 lines (288 loc) · 9.41 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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
FROM phusion/baseimage:0.11
#ARG STEEMD_BLOCKCHAIN=https://example.com/steemd-blockchain.tbz2
ARG STEEM_STATIC_BUILD=ON
ENV STEEM_STATIC_BUILD ${STEEM_STATIC_BUILD}
ARG BUILD_STEP
ENV BUILD_STEP ${BUILD_STEP}
ARG CI_BUILD
ENV CI_BUILD ${CI_BUILD}
ENV LANG=en_US.UTF-8
RUN \
apt-get update && \
apt-get install -y \
autoconf \
automake \
autotools-dev \
bsdmainutils \
build-essential \
cmake \
doxygen \
gdb \
git \
libboost-all-dev \
libyajl-dev \
libreadline-dev \
libssl-dev \
libtool \
liblz4-tool \
ncurses-dev \
pkg-config \
python3 \
python3-dev \
python3-jinja2 \
python3-pip \
nginx \
fcgiwrap \
awscli \
jq \
wget \
virtualenv \
gdb \
libgflags-dev \
libsnappy-dev \
zlib1g-dev \
libbz2-dev \
liblz4-dev \
libzstd-dev \
&& \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \
pip3 install gcovr
ADD . /usr/local/src/steem
RUN \
if [ "$CI_BUILD" ] ; then \
pip3 install awscli --user && \
aws s3 cp s3://steemit-dev-ci/steemd-CTestCostData.txt /usr/local/src/steem/CTestCostData.txt ; \
fi
RUN \
if [ "$BUILD_STEP" = "1" ] || [ ! "$BUILD_STEP" ] ; then \
cd /usr/local/src/steem && \
git submodule update --init --recursive && \
mkdir build && \
cd build && \
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_STEEM_TESTNET=ON \
-DLOW_MEMORY_NODE=OFF \
-DCLEAR_VOTES=ON \
-DSKIP_BY_TX_ID=ON \
.. && \
make -j$(nproc) chain_test test_fixed_string plugin_test && \
if [ "$CI_BUILD" ] ; then \
mkdir -p build/tests/Testing/Temporary && \
cp /usr/local/src/steem/CTestCostData.txt build/tests/Testing/Temporary ; \
fi && \
cd tests && \
ctest -j$(nproc) --output-on-failure && \
./chain_test -t basic_tests/curation_weight_test && \
cd .. && \
./programs/util/test_fixed_string && \
cd /usr/local/src/steem && \
doxygen && \
PYTHONPATH=programs/build_helpers \
python3 -m steem_build_helpers.check_reflect && \
programs/build_helpers/get_config_check.sh && \
rm -rf /usr/local/src/steem/build ; \
fi
RUN \
if [ "$BUILD_STEP" = "2" ] || [ ! "$BUILD_STEP" ] ; then \
cd /usr/local/src/steem && \
git submodule update --init --recursive && \
mkdir build && \
cd build && \
cmake \
-DCMAKE_INSTALL_PREFIX=/usr/local/steemd-testnet \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_STEEM_TESTNET=ON \
-DLOW_MEMORY_NODE=OFF \
-DCLEAR_VOTES=ON \
-DSKIP_BY_TX_ID=ON \
-DENABLE_MIRA=ON \
-DSTEEM_STATIC_BUILD=${STEEM_STATIC_BUILD} \
.. && \
make -j$(nproc) chain_test mira_test test_fixed_string plugin_test && \
make install && \
if [ "$CI_BUILD" ] ; then \
mkdir -p build/tests/Testing/Temporary && \
cp /usr/local/src/steem/CTestCostData.txt build/tests/Testing/Temporary ; \
fi && \
cd tests && \
ctest -j$(nproc) --output-on-failure && \
cd .. && \
./libraries/mira/test/mira_test && \
./programs/util/test_fixed_string && \
cd /usr/local/src/steem && \
doxygen && \
PYTHONPATH=programs/build_helpers \
python3 -m steem_build_helpers.check_reflect && \
programs/build_helpers/get_config_check.sh && \
if [ "$CI_BUILD" ] ; then \
aws s3 cp s3://steemit-dev-ci/steemd-CTestCostData.txt s3://steemit-dev-ci/steemd-CTestCostData.txt.bk && \
aws s3 cp build/tests/Testing/Temporary/CTestCostData.txt s3://steemit-dev-ci/steemd-CTestCostData.txt; \
fi && \
rm -rf /usr/local/src/steem/build ; \
fi
RUN \
if [ "$BUILD_STEP" = "1" ] || [ ! "$BUILD_STEP" ] ; then \
cd /usr/local/src/steem && \
git submodule update --init --recursive && \
mkdir build && \
cd build && \
cmake \
-DCMAKE_BUILD_TYPE=Debug \
-DENABLE_COVERAGE_TESTING=ON \
-DBUILD_STEEM_TESTNET=ON \
-DLOW_MEMORY_NODE=OFF \
-DCLEAR_VOTES=ON \
-DSKIP_BY_TX_ID=ON \
-DENABLE_MIRA=ON \
-DCHAINBASE_CHECK_LOCKING=OFF \
.. && \
make -j$(nproc) chain_test plugin_test && \
if [ "$CI_BUILD" ] ; then \
mkdir -p build/tests/Testing/Temporary && \
cp /usr/local/src/steem/CTestCostData.txt build/tests/Testing/Temporary ; \
fi && \
cd tests && \
ctest -j$(nproc) --output-on-failure && \
cd .. && \
mkdir -p /var/cobertura && \
gcovr --object-directory="../" --root=../ --xml-pretty --gcov-exclude=".*tests.*" --gcov-exclude=".*fc.*" --gcov-exclude=".*app*" --gcov-exclude=".*net*" --gcov-exclude=".*plugins*" --gcov-exclude=".*schema*" --gcov-exclude=".*time*" --gcov-exclude=".*utilities*" --gcov-exclude=".*wallet*" --gcov-exclude=".*programs*" --gcov-exclude=".*vendor*" --output="/var/cobertura/coverage.xml" && \
cd /usr/local/src/steem && \
rm -rf /usr/local/src/steem/build ; \
fi
RUN \
if [ "$BUILD_STEP" = "2" ] || [ ! "$BUILD_STEP" ] ; then \
cd /usr/local/src/steem && \
git submodule update --init --recursive && \
mkdir build && \
cd build && \
cmake \
-DCMAKE_INSTALL_PREFIX=/usr/local/steemd-default \
-DCMAKE_BUILD_TYPE=Release \
-DLOW_MEMORY_NODE=ON \
-DCLEAR_VOTES=ON \
-DSKIP_BY_TX_ID=OFF \
-DBUILD_STEEM_TESTNET=OFF \
-DENABLE_MIRA=ON \
-DSTEEM_STATIC_BUILD=${STEEM_STATIC_BUILD} \
.. \
&& \
make -j$(nproc) && \
make install && \
cd .. && \
( /usr/local/steemd-default/bin/steemd --version \
| grep -o '[0-9]*\.[0-9]*\.[0-9]*' \
&& echo '_' \
&& git rev-parse --short HEAD ) \
| sed -e ':a' -e 'N' -e '$!ba' -e 's/\n//g' \
> /etc/steemdversion && \
cat /etc/steemdversion && \
rm -rfv build && \
mkdir build && \
cd build && \
cmake \
-DCMAKE_INSTALL_PREFIX=/usr/local/steemd-full \
-DCMAKE_BUILD_TYPE=Release \
-DLOW_MEMORY_NODE=OFF \
-DCLEAR_VOTES=OFF \
-DSKIP_BY_TX_ID=ON \
-DBUILD_STEEM_TESTNET=OFF \
-DENABLE_MIRA=ON \
-DSTEEM_STATIC_BUILD=${STEEM_STATIC_BUILD} \
.. \
&& \
make -j$(nproc) && \
make install && \
rm -rf /usr/local/src/steem ; \
fi
RUN \
apt-get remove -y \
automake \
autotools-dev \
bsdmainutils \
build-essential \
cmake \
doxygen \
dpkg-dev \
libboost-all-dev \
libc6-dev \
libexpat1-dev \
libgcc-7-dev \
libhwloc-dev \
libibverbs-dev \
libicu-dev \
libltdl-dev \
libncurses5-dev \
libnuma-dev \
libopenmpi-dev \
libpython-dev \
libpython2.7-dev \
libreadline-dev \
libreadline6-dev \
libssl-dev \
libstdc++-7-dev \
libtinfo-dev \
libtool \
linux-libc-dev \
m4 \
make \
manpages \
manpages-dev \
mpi-default-dev \
python-dev \
python2.7-dev \
python3-dev \
&& \
apt-get autoremove -y && \
rm -rf \
/var/lib/apt/lists/* \
/tmp/* \
/var/tmp/* \
/var/cache/* \
/usr/include \
/usr/local/include
RUN useradd -s /bin/bash -m -d /var/lib/steemd steemd
RUN mkdir /var/cache/steemd && \
chown steemd:steemd -R /var/cache/steemd
# add blockchain cache to image
#ADD $STEEMD_BLOCKCHAIN /var/cache/steemd/blocks.tbz2
ENV HOME /var/lib/steemd
RUN chown steemd:steemd -R /var/lib/steemd
VOLUME ["/var/lib/steemd"]
# rpc service:
EXPOSE 8090
# p2p service:
EXPOSE 2001
# add seednodes from documentation to image
ADD doc/seednodes.txt /etc/steemd/seednodes.txt
# the following adds lots of logging info to stdout
ADD contrib/config-for-docker.ini /etc/steemd/config.ini
ADD contrib/fullnode.config.ini /etc/steemd/fullnode.config.ini
ADD contrib/fullnode.opswhitelist.config.ini /etc/steemd/fullnode.opswhitelist.config.ini
ADD contrib/config-for-broadcaster.ini /etc/steemd/config-for-broadcaster.ini
ADD contrib/config-for-ahnode.ini /etc/steemd/config-for-ahnode.ini
# add normal startup script that starts via sv
ADD contrib/steemd.run /usr/local/bin/steem-sv-run.sh
RUN chmod +x /usr/local/bin/steem-sv-run.sh
# add nginx templates
ADD contrib/steemd.nginx.conf /etc/nginx/steemd.nginx.conf
ADD contrib/healthcheck.conf.template /etc/nginx/healthcheck.conf.template
# add PaaS startup script and service script
ADD contrib/startpaassteemd.sh /usr/local/bin/startpaassteemd.sh
ADD contrib/pulltestnetscripts.sh /usr/local/bin/pulltestnetscripts.sh
ADD contrib/paas-sv-run.sh /usr/local/bin/paas-sv-run.sh
ADD contrib/sync-sv-run.sh /usr/local/bin/sync-sv-run.sh
ADD contrib/healthcheck.sh /usr/local/bin/healthcheck.sh
RUN chmod +x /usr/local/bin/startpaassteemd.sh
RUN chmod +x /usr/local/bin/pulltestnetscripts.sh
RUN chmod +x /usr/local/bin/paas-sv-run.sh
RUN chmod +x /usr/local/bin/sync-sv-run.sh
RUN chmod +x /usr/local/bin/healthcheck.sh
# new entrypoint for all instances
# this enables exitting of the container when the writer node dies
# for PaaS mode (elasticbeanstalk, etc)
# AWS EB Docker requires a non-daemonized entrypoint
ADD contrib/steemdentrypoint.sh /usr/local/bin/steemdentrypoint.sh
RUN chmod +x /usr/local/bin/steemdentrypoint.sh
CMD /usr/local/bin/steemdentrypoint.sh