forked from scorum/scorum
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
229 lines (206 loc) · 6.55 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
FROM phusion/baseimage:0.9.19
#ARG SCORUMD_BLOCKCHAIN=https://example.com/scorumd-blockchain.tbz2
ARG BRANCH_NAME
ARG GIT_COMMIT
ARG AZURE_UPLOAD
ARG AZURE_STORAGE_ACCOUNT
ARG AZURE_STORAGE_ACCESS_KEY
ARG AZURE_STORAGE_CONNECTION_STRING
ARG UPLOAD_PATH
ARG BUILD_VERSION
ENV LANG=en_US.UTF-8
RUN \
apt-get update && \
apt-get install -y \
autoconf \
automake \
autotools-dev \
bsdmainutils \
build-essential \
cmake \
doxygen \
git \
libboost-all-dev \
libreadline-dev \
libssl-dev \
libtool \
ncurses-dev \
pbzip2 \
pkg-config \
python3 \
python3-dev \
python3-jinja2 \
python3-pip \
python-pip \
nginx \
fcgiwrap \
s3cmd \
awscli \
jq \
wget \
gdb \
&& \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \
pip3 install gcovr && \
pip install azure-cli
ADD . /usr/local/src/scorum
RUN \
cd /usr/local/src/scorum && \
mkdir build && \
cd build && \
cmake \
-DCMAKE_BUILD_TYPE=Debug \
-DENABLE_COVERAGE_TESTING=ON \
-DLOW_MEMORY_NODE=OFF \
-DCLEAR_VOTES=ON \
-DSKIP_BY_TX_ID=ON \
.. && \
make -j$(nproc) && \
./libraries/chainbase/test/chainbase_test && \
./tests/utests/utests && \
./tests/chain_tests/chain_tests && \
./tests/wallet_tests/wallet_tests && \
cd /usr/local/src/scorum && \
doxygen && \
programs/build_helpers/check_reflect.py && \
programs/build_helpers/get_config_check.sh && \
cd /usr/local/src/scorum/build && \
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*" --output="/var/cobertura/coverage.xml" && \
cd /usr/local/src/scorum && \
rm -rf /usr/local/src/scorum/build
RUN \
cd /usr/local/src/scorum && \
mkdir build && \
cd build && \
cmake \
-DCMAKE_INSTALL_PREFIX=/usr/local/scorumd-default \
-DCMAKE_BUILD_TYPE=Release \
-DLOW_MEMORY_NODE=ON \
-DCLEAR_VOTES=ON \
-DSKIP_BY_TX_ID=ON \
.. && \
make -j$(nproc) && \
./libraries/chainbase/test/chainbase_test && \
./tests/utests/utests && \
./tests/chain_tests/chain_tests && \
./tests/wallet_tests/wallet_tests && \
./programs/util/test_fixed_string && \
make install && \
rm -rf /usr/local/src/scorum/build
RUN \
cd /usr/local/src/scorum && \
mkdir build && \
cd build && \
cmake \
-DCMAKE_INSTALL_PREFIX=/usr/local/scorumd-full \
-DCMAKE_BUILD_TYPE=Release \
-DLOW_MEMORY_NODE=OFF \
-DCLEAR_VOTES=OFF \
-DSKIP_BY_TX_ID=ON \
.. && \
make -j$(nproc) && \
./libraries/chainbase/test/chainbase_test && \
./tests/utests/utests && \
./tests/chain_tests/chain_tests && \
./tests/wallet_tests/wallet_tests && \
./programs/util/test_fixed_string && \
make install && \
cd / && \
rm -rf /usr/local/src/scorum
RUN \
( /usr/local/scorumd-full/bin/scorumd --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/scorumdversion && \
cat /etc/scorumdversion
RUN \
apt-get remove -y \
automake \
autotools-dev \
bsdmainutils \
build-essential \
cmake \
doxygen \
dpkg-dev \
git \
libboost-all-dev \
libc6-dev \
libexpat1-dev \
libgcc-5-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++-5-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/scorumd scorumd
RUN mkdir /var/cache/scorumd && \
chown scorumd:scorumd -R /var/cache/scorumd
# add blockchain cache to image
#ADD $SCORUMD_BLOCKCHAIN /var/cache/scorumd/blocks.tbz2
ENV HOME /var/lib/scorumd
RUN chown scorumd:scorumd -R /var/lib/scorumd
VOLUME ["/var/lib/scorumd"]
# rpc service:
EXPOSE 8090
# p2p service:
EXPOSE 2001
# add seednodes from documentation to image
ADD doc/seednodes.txt /etc/scorumd/seednodes.txt
# the following adds lots of logging info to stdout
ADD contrib/fullnode.config.ini /etc/scorumd/fullnode.config.ini
# add normal startup script that start via runsv
RUN mkdir /etc/sv/scorumd
RUN mkdir /etc/sv/scorumd/log
ADD contrib/runsv/scorumd.run /etc/sv/scorumd/run
ADD contrib/runsv/scorumd-log.run /etc/sv/scorumd/log/run
ADD contrib/runsv/scorumd-log.config /etc/sv/scorumd/log/config
RUN chmod +x /etc/sv/scorumd/run /etc/sv/scorumd/log/run
# add nginx templates
ADD contrib/scorumd.nginx.conf /etc/nginx/scorumd.nginx.conf
ADD contrib/healthcheck.conf.template /etc/nginx/healthcheck.conf.template
# add healthcheck script
ADD contrib/healthcheck.sh /usr/local/bin/healthcheck.sh
RUN chmod +x /usr/local/bin/healthcheck.sh
# upload archive to azure
ADD contrib/azure_upload.sh /usr/local/bin/azure_upload.sh
RUN chmod +x /usr/local/bin/azure_upload.sh
RUN /usr/local/bin/azure_upload.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/scorumdentrypoint.sh /usr/local/bin/scorumdentrypoint.sh
RUN chmod +x /usr/local/bin/scorumdentrypoint.sh
CMD /usr/local/bin/scorumdentrypoint.sh