-
Notifications
You must be signed in to change notification settings - Fork 30
/
Dockerfile
287 lines (262 loc) · 8.47 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
#######################################################################
##- Copyright (c) Huawei Technologies Co., Ltd. 2019. All rights reserved.
# - lcr licensed under the Mulan PSL v2.
# - You can use this software according to the terms and conditions of the Mulan PSL v2.
# - You may obtain a copy of Mulan PSL v2 at:
# - http://license.coscl.org.cn/MulanPSL2
# - THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
# - IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
# - PURPOSE.
# - See the Mulan PSL v2 for more details.
##- @Description: prepare compile container environment
##- @Author: lifeng
##- @Create: 2020-01-10
#######################################################################
# This file describes the isulad compile container image.
#
# Usage:
#
# docker build --build-arg http_proxy=YOUR_HTTP_PROXY_IF_NEEDED \
# --build-arg https_proxy=YOUR_HTTPS_PROXY_IF_NEEDED \
# -t YOUR_IMAGE_NAME -f ./Dockerfile .
FROM centos:7.6.1810 AS build
MAINTAINER LiFeng <[email protected]>
RUN echo "nameserver 8.8.8.8" > /etc/resolv.conf && \
echo "nameserver 8.8.4.4" >> /etc/resolv.conf && \
echo "search localdomain" >> /etc/resolv.conf
# Install dependency package
RUN yum clean all && yum makecache && yum install -y epel-release && yum swap -y fakesystemd systemd && \
yum update -y && \
yum install -y automake \
autoconf \
libtool \
make \
which \
gdb \
strace \
rpm-build \
graphviz \
libcap \
libcap-devel \
libxslt \
docbook2X \
libselinux \
libselinux-devel \
libseccomp \
libseccomp-devel \
yajl-devel \
git \
bridge-utils \
dnsmasq \
libcgroup \
rsync \
iptables \
iproute \
net-tools \
unzip \
tar \
wget \
cppcheck \
python3 \
python3-pip \
python \
python-pip \
device-mapper-devel \
libtar \
libtar-devel \
libcurl-devel \
zlib-devel \
glibc-headers \
openssl-devel \
gcc \
gcc-c++ \
hostname \
sqlite-devel \
gpgme \
gpgme-devel \
expect \
systemd-devel \
systemd-libs \
go \
CUnit \
CUnit-devel \
valgrind \
e2fsprogs
RUN pip3 install meson ninja
RUN yum clean all && \
(cd /lib/systemd/system/sysinit.target.wants/; for i in *; \
do [ $i == systemd-tmpfiles-setup.service ] || rm -f $i; done); \
rm -f /lib/systemd/system/multi-user.target.wants/*;\
rm -f /etc/systemd/system/*.wants/*;\
rm -f /lib/systemd/system/local-fs.target.wants/*; \
rm -f /lib/systemd/system/sockets.target.wants/*udev*; \
rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \
rm -f /lib/systemd/system/basic.target.wants/*;\
rm -f /lib/systemd/system/anaconda.target.wants/*;
RUN echo "export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH" >> /etc/bashrc && \
echo "export LD_LIBRARY_PATH=/usr/local/lib:/usr/lib:$LD_LIBRARY_PATH" >> /etc/bashrc && \
echo "/usr/lib" >> /etc/ld.so.conf && \
echo "/usr/local/lib" >> /etc/ld.so.conf
# disalbe sslverify
RUN git config --global http.sslverify false
# install cmake
RUN set -x && \
cd ~ && \
git clone https://gitee.com/src-openeuler/cmake.git && \
cd cmake && \
git checkout -b openEuler-20.03-LTS-tag openEuler-20.03-LTS-tag && \
tar -xzvf cmake-3.12.1.tar.gz && \
cd cmake-3.12.1 && \
./bootstrap && make && make install && \
ldconfig
# Centos has no protobuf, protobuf-devel, grpc, grpc-devel, grpc-plugin
# and we should install them manually.
# install protobuf
RUN set -x && \
cd ~ && \
git clone https://gitee.com/src-openeuler/protobuf.git && \
cd protobuf && \
git checkout -b openEuler-20.03-LTS-tag openEuler-20.03-LTS-tag && \
tar -xzvf protobuf-all-3.9.0.tar.gz && \
cd protobuf-3.9.0 && \
./autogen.sh && \
./configure && \
make -j $(nproc) && \
make install && \
ldconfig
# install c-ares
RUN export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH && \
set -x && \
cd ~ && \
git clone https://gitee.com/src-openeuler/c-ares.git && \
cd c-ares && \
git checkout -b openEuler-20.03-LTS-tag openEuler-20.03-LTS-tag && \
tar -xzvf c-ares-1.15.0.tar.gz && \
cd c-ares-1.15.0 && \
autoreconf -if && \
./configure --enable-shared --disable-dependency-tracking && \
make -j $(nproc) && \
make install && \
ldconfig
# install grpc
RUN export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH && \
set -x && \
cd ~ && \
git clone https://gitee.com/src-openeuler/grpc.git && \
cd grpc && \
git checkout -b openEuler-20.03-LTS-tag openEuler-20.03-LTS-tag && \
tar -xzvf grpc-1.22.0.tar.gz && \
cd grpc-1.22.0 && \
make -j $(nproc) && \
make install && \
ldconfig
# install libevent
RUN export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH && \
set -x && \
cd ~ && \
git clone https://gitee.com/src-openeuler/libevent.git && \
cd libevent && \
git checkout -b openEuler-20.03-LTS-tag openEuler-20.03-LTS-tag && \
tar -xzvf libevent-2.1.11-stable.tar.gz && \
cd libevent-2.1.11-stable && \
./autogen.sh && \
./configure && \
make -j $(nproc) && \
make install && \
ldconfig
# install libevhtp
RUN export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH && \
set -x && \
cd ~ && \
git clone https://gitee.com/src-openeuler/libevhtp.git && \
cd libevhtp && \
git checkout -b openEuler-20.03-LTS-tag openEuler-20.03-LTS-tag && \
tar -xzvf libevhtp-1.2.16.tar.gz && \
cd libevhtp-1.2.16 && \
patch -p1 -F1 -s < ../0001-support-dynamic-threads.patch && \
patch -p1 -F1 -s < ../0002-close-openssl.patch && \
rm -rf build && \
mkdir build && \
cd build && \
cmake -D EVHTP_BUILD_SHARED=on -D EVHTP_DISABLE_SSL=on ../ && \
make -j $(nproc) && \
make install && \
ldconfig
# install libwebsockets
RUN export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH && \
set -x && \
cd ~ && \
git clone https://gitee.com/src-openeuler/libwebsockets.git && \
cd libwebsockets && \
git checkout -b openEuler-20.03-LTS-tag openEuler-20.03-LTS-tag && \
tar -xzvf libwebsockets-2.4.2.tar.gz && \
cd libwebsockets-2.4.2 && \
patch -p1 -F1 -s < ../libwebsockets-fix-coredump.patch && \
mkdir build && \
cd build && \
cmake -DLWS_WITH_SSL=0 -DLWS_MAX_SMP=32 -DCMAKE_BUILD_TYPE=Debug ../ && \
make -j $(nproc) && \
make install && \
ldconfig
# install gtest/gmock
RUN export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH && \
set -x && \
cd ~ && \
git clone https://gitee.com/src-openeuler/gtest.git && \
cd gtest && \
git checkout -b openEuler-20.03-LTS-tag openEuler-20.03-LTS-tag && \
tar xf release-1.8.1.tar.gz && \
cd googletest-release-1.8.1 && \
patch -p1 -F1 -s < ../gtest-1.8.1-null-pointer.patch && \
patch -p1 -F1 -s < ../gtest-PR1839-Fix-Python3-support.patch && \
patch -p1 -F1 -s < ../gtest-1.8.1-libversion.patch && \
patch -p1 -F1 -s < ../gtest-1.8.1-add-missing-pkgconfig-requires.patch && \
mkdir -p build && \
cd build && \
cmake -DBUILD_SHARED_LIBS=ON ../ && \
make -j $(nproc) && \
make install && \
ldconfig
# install libarchive
RUN export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH && \
set -x && \
cd ~ && \
git clone https://gitee.com/src-openeuler/libarchive.git && \
cd libarchive && \
git checkout -b openEuler-20.03-LTS-tag openEuler-20.03-LTS-tag && \
tar -zxvf libarchive-3.4.1.tar.gz && \
cd libarchive-3.4.1 && \
patch -p1 -F1 -s < ../libarchive-uninitialized-value.patch && \
cd build && \
cmake -DCMAKE_USE_SYSTEM_LIBRARIES=ON ../ && \
make -j $(nproc) && \
make install && \
ldconfig
RUN export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH && \
set -x && \
cd ~ && \
git clone https://gitee.com/openeuler/iSulad/ &&\
cd iSulad &&\
# git checkout 756c0bdc308c2845971ad9ca0c58760a84288bc0 &&\
git checkout v2.0.6 &&\
cd CI &&\
./install_depends.sh &&\
cd .. &&\
mkdir build &&\
cd build &&\
cmake .. &&\
make -j $(nproc) && \
make install && \
ldconfig
FROM centos:7.6.1810
COPY --from=build /usr/local/bin /usr/local/bin
COPY --from=build /usr/local/lib /usr/local/lib
COPY --from=build /usr/local/lib64 /usr/local/lib64
COPY --from=build /usr/lib64 /usr/lib64
COPY --from=build /etc/default/isulad/ /etc/default/isulad/
COPY --from=build /etc/isulad /etc/isulad
RUN echo "/usr/lib" >> /etc/ld.so.conf && \
echo "/usr/local/lib" >> /etc/ld.so.conf &&\
ldconfig
VOLUME [ "/sys/fs/cgroup" ]
CMD ["/usr/local/bin/isulad"]