1
1
FROM centos:7 as fiu
2
2
LABEL maintainer=
"Cyber-SiKu <[email protected] >"
3
- # ADD https://mirrors.163.com/.help/CentOS7-Base-163.repo /etc/yum.repos.d/CentOS-Base.repo
4
- RUN yum clean all && yum makecache \
5
- && yum install -y wget \
6
- gcc \
7
- python3 \
8
- make \
9
- && wget https://github.com/albertito/libfiu/archive/refs/tags/1.00.tar.gz \
10
- && tar -xzvf 1.00.tar.gz \
11
- && cd libfiu-1.00 \
12
- && make && make install
3
+ RUN yum install -y \
4
+ centos-release-scl \
5
+ centos-release-scl-rh&& \
6
+ yum update -y && \
7
+ yum clean all
8
+ ADD https://curve-build.nos-eastchina1.126.net/libfiu-1.00.tar.gz /
9
+ RUN yum install -y \
10
+ devtoolset-9-gcc \
11
+ devtoolset-9-gcc-c++ \
12
+ devtoolset-9-libstdc++-devel \
13
+ devtoolset-9-make \
14
+ python3 && \
15
+ echo "source /opt/rh/devtoolset-9/enable" >> /etc/bashrc && \
16
+ source /etc/bashrc && \
17
+ tar -xzvf libfiu-1.00.tar.gz && rm libfiu-1.00.tar.gz && \
18
+ cd libfiu-1.00 && \
19
+ make && make install
13
20
14
- FROM centos:7 as builder
21
+ FROM centos:7 AS curve-builder
22
+ LABEL maintainer=
"Cyber-SiKu <[email protected] >"
23
+ COPY --from=fiu /usr/local/include/fiu*.h /usr/include/
24
+ COPY --from=fiu /usr/local/lib/ /usr/lib
25
+ ARG TARGETARCH
26
+ RUN yum install -y \
27
+ wget \
28
+ patch \
29
+ zlib-devel \
30
+ openssl-devel \
31
+ libuuid-devel \
32
+ libnl3-devel \
33
+ libcurl-devel \
34
+ python3-devel \
35
+ python3-setuptools \
36
+ python3-wheel \
37
+ libunwind-devel \
38
+ fuse3-devel \
39
+ sudo \
40
+ lz4-devel \
41
+ snappy-devel \
42
+ centos-release-scl \
43
+ centos-release-scl-rh \
44
+ which && \
45
+ if [ "$TARGETARCH" = "amd64" ]; then \
46
+ OCI_ARCH=x86_64; \
47
+ elif [ "$TARGETARCH" = "arm64" ]; then \
48
+ OCI_ARCH=aarch64; \
49
+ else \
50
+ OCI_ARCH=x86_64; \
51
+ fi && \
52
+ wget https://curve-build.nos-eastchina1.126.net/bazelbuild/bazelisk/bazelisk-linux-${OCI_ARCH} && \
53
+ mv bazelisk-linux-${OCI_ARCH} /usr/bin/bazelisk && \
54
+ ln -s /usr/bin/bazelisk /usr/bin/bazel && \
55
+ wget https://curve-build.nos-eastchina1.126.net/bazelbuild/4.2.2/bazel-4.2.2-linux-${OCI_ARCH} && \
56
+ mkdir -p /root/.cache/bazelisk/downloads/bazelbuild/bazel-4.2.2-linux-${OCI_ARCH}/bin && \
57
+ mv bazel-4.2.2-linux-${OCI_ARCH} /root/.cache/bazelisk/downloads/bazelbuild/bazel-4.2.2-linux-${OCI_ARCH}/bin/bazel && \
58
+ wget https://curve-build.nos-eastchina1.126.net/bazelbuild/0.17.2/bazel-0.17.2-linux-${OCI_ARCH} && \
59
+ mkdir -p /root/.cache/bazelisk/downloads/bazelbuild/bazel-0.17.2-linux-${OCI_ARCH}/bin && \
60
+ mv bazel-0.17.2-linux-${OCI_ARCH} /root/.cache/bazelisk/downloads/bazelbuild/bazel-0.17.2-linux-${OCI_ARCH}/bin/bazel && \
61
+ chmod +x /root/.cache/bazelisk/downloads/bazelbuild/bazel-4.2.2-linux-${OCI_ARCH}/bin/bazel /root/.cache/bazelisk/downloads/bazelbuild/bazel-0.17.2-linux-${OCI_ARCH}/bin/bazel /usr/bin/bazel /usr/bin/bazelisk && \
62
+ yum install -y \
63
+ devtoolset-9-gcc \
64
+ devtoolset-9-gcc-c++ \
65
+ devtoolset-9-libstdc++-devel \
66
+ devtoolset-9-make \
67
+ llvm-toolset-7-cmake \
68
+ sclo-git212 && \
69
+ echo "source /opt/rh/devtoolset-9/enable" >> /etc/bashrc && \
70
+ echo "source /opt/rh/llvm-toolset-7/enable" >> /etc/bashrc && \
71
+ echo "source /opt/rh/sclo-git212/enable" >> /etc/bashrc && \
72
+ source /etc/bashrc && \
73
+ pip3 install pyinstaller -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com
74
+
75
+ FROM curve-builder AS curve-1.2.5
76
+ LABEL maintainer=
"Cyber-SiKu <[email protected] >"
77
+ ADD https://github.com/opencurve/curve/archive/refs/tags/v1.2.5.tar.gz /
78
+ RUN source /etc/bashrc && \
79
+ tar xvf v1.2.5.tar.gz && rm v1.2.5.tar.gz && \
80
+ cd /curve-1.2.5/ && bash replace-curve-repo.sh && \
81
+ git init && sed -i "s;python2;python3;g" mk-tar.sh && \
82
+ sed -i "s;tag_version=9.9.9;tag_version=1.2.5;g" mk-tar.sh && \
83
+ sed -i "s;commit_id=`git show --abbrev-commit HEAD|head -n 1|awk '{print \$ 2}'`;commit_id=\" 86e8e1a\" ;g" mk-tar.sh && \
84
+ bash mk-tar.sh release && mv curve_1.2.5+86e8e1a.tar.gz / && \
85
+ cd / && rm /curve-1.2.5/ -rf
86
+
87
+ FROM centos:7 AS polardb-builder
88
+ LABEL maintainer=
"Cyber-SiKu <[email protected] >"
89
+ CMD bash
90
+ # avoid missing locale problem
91
+ RUN sed -i 's/override_install_langs/# &/' /etc/yum.conf
92
+ # add EPEL and scl source
93
+ RUN rpmkeys --import file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 && \
94
+ yum install -y epel-release centos-release-scl && \
95
+ rpmkeys --import file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7 && \
96
+ rpmkeys --import file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo && \
97
+ yum update -y && \
98
+ yum clean all
99
+ # GCC and LLVM
100
+ RUN yum install -y \
101
+ devtoolset-9-gcc \
102
+ devtoolset-9-gcc-c++ \
103
+ devtoolset-9-gdb \
104
+ devtoolset-9-libstdc++-devel \
105
+ devtoolset-9-make \
106
+ llvm-toolset-7.0-llvm-devel \
107
+ llvm-toolset-7.0-clang-devel \
108
+ llvm-toolset-7.0-cmake && \
109
+ yum clean all
110
+ # dependencies
111
+ RUN yum install -y \
112
+ libicu-devel \
113
+ pam-devel \
114
+ readline-devel \
115
+ libxml2-devel \
116
+ libxslt-devel \
117
+ openldap-devel \
118
+ openldap-clients \
119
+ openldap-servers \
120
+ libuuid-devel \
121
+ xerces-c-devel \
122
+ bison \
123
+ flex \
124
+ gettext \
125
+ tcl-devel \
126
+ python-devel \
127
+ perl-IPC-Run \
128
+ perl-Expect \
129
+ perl-Test-Simple \
130
+ perl-DBD-Pg \
131
+ perl-ExtUtils-Embed \
132
+ perl-ExtUtils-MakeMaker \
133
+ zlib-devel \
134
+ krb5-devel \
135
+ krb5-workstation \
136
+ krb5-server \
137
+ protobuf-devel \
138
+ libaio-devel \
139
+ fuse-devel \
140
+ gtest-devel && \
141
+ ln /usr/lib64/perl5/CORE/libperl.so /usr/lib64/libperl.so && \
142
+ yum clean all
143
+ # install basic tools
144
+ RUN yum install -y \
145
+ git lcov psmisc sudo vim \
146
+ less \
147
+ net-tools \
148
+ python2-psycopg2 \
149
+ python2-requests \
150
+ tar \
151
+ shadow-utils \
152
+ which \
153
+ binutils\
154
+ libtool \
155
+ perf \
156
+ make sudo \
157
+ wget \
158
+ util-linux && \
159
+ yum clean all
15
160
16
- COPY --from=fiu /usr/local/include/fiu*.h /usr/local/include/
17
- COPY --from=fiu /usr/local/lib/ /usr/local/lib
18
- RUN yum clean all && yum makecache \
19
- && yum install -y wget \
20
- make \
21
- patch \
22
- gcc \
23
- gcc-c++ \
24
- clang \
25
- zlib-devel \
26
- openssl-devel \
27
- libuuid-devel \
28
- libnl3-devel \
29
- libcurl-devel \
30
- python-devel \
31
- python-setuptools \
32
- python3-devel \
33
- python3-setuptools \
34
- python3-wheel \
35
- libunwind-devel \
36
- sudo \
37
- && wget https://curve-build.nos-eastchina1.126.net/bazelbuild/bazelisk/bazelisk-linux-amd64 \
38
- && mv bazelisk-linux-amd64 /usr/bin/bazelisk \
39
- && ln -s /usr/bin/bazelisk /usr/bin/bazel \
40
- && wget https://curve-build.nos-eastchina1.126.net/bazelbuild/4.2.2/bazel-4.2.2-linux-x86_64 \
41
- && mkdir -p /root/.cache/bazelisk/downloads/bazelbuild/bazel-4.2.2-linux-x86_64/bin \
42
- && mv bazel-4.2.2-linux-x86_64 /root/.cache/bazelisk/downloads/bazelbuild/bazel-4.2.2-linux-x86_64/bin/bazel \
43
- && wget https://curve-build.nos-eastchina1.126.net/bazelbuild/0.17.2/bazel-0.17.2-linux-x86_64\
44
- && mkdir -p /root/.cache/bazelisk/downloads/bazelbuild/bazel-0.17.2-linux-x86_64/bin \
45
- && mv bazel-0.17.2-linux-x86_64 /root/.cache/bazelisk/downloads/bazelbuild/bazel-0.17.2-linux-x86_64/bin/bazel \
46
- && chmod +x /root/.cache/bazelisk/downloads/bazelbuild/bazel-4.2.2-linux-x86_64/bin/bazel /root/.cache/bazelisk/downloads/bazelbuild/bazel-0.17.2-linux-x86_64/bin/bazel /usr/bin/bazel /usr/bin/bazelisk \
47
- && yum install -y https://packages.endpointdev.com/rhel/7/os/x86_64/endpoint-repo.x86_64.rpm \
48
- && yum install -y git
161
+ # copy curve-sdk
162
+ COPY --from=curve-1.2.5 /curve_1.2.5+86e8e1a.tar.gz /
163
+ RUN tar -zxvf curve_1.2.5+86e8e1a.tar.gz && rm curve_1.2.5+86e8e1a.tar.gz && \
164
+ cd /curve/curve-sdk && \
165
+ cp -f lib/* /usr/lib64 && \
166
+ cp -f bin/* /usr/bin && \
167
+ mkdir -p /usr/curvefs && \
168
+ cp -f curvefs/* /usr/curvefs && \
169
+ cp -f include/* /usr/include && \
170
+ rm -rf /curve
171
+ # set to empty if GitHub is not barriered
172
+ # ENV GITHUB_PROXY=https://ghproxy.com/
173
+ ENV GITHUB_PROXY=
174
+ ENV ZLOG_VERSION=1.2.14
175
+ ENV OPENSSL_VERSION=OpenSSL_1_1_1k
176
+ ENV PFSD_VERSION=curvebs_sdk_devio
177
+ # install dependencies from GitHub mirror
178
+ RUN cd /usr/local && \
179
+ # zlog for PFSD
180
+ wget --no-verbose --no-check-certificate "${GITHUB_PROXY}https://github.com/HardySimpson/zlog/archive/refs/tags/${ZLOG_VERSION}.tar.gz" && \
181
+ # PFSD
182
+ wget --no-verbose --no-check-certificate "${GITHUB_PROXY}https://github.com/opencurve/PolarDB-FileSystem/archive/refs/heads/${PFSD_VERSION}.tar.gz" && \
183
+ # OpenSSL 1.1.1
184
+ wget --no-verbose --no-check-certificate "${GITHUB_PROXY}https://github.com/openssl/openssl/archive/refs/tags/${OPENSSL_VERSION}.tar.gz" && \
185
+ # enable build tools
186
+ echo "source /opt/rh/devtoolset-9/enable" >> /etc/bashrc && \
187
+ echo "source /opt/rh/llvm-toolset-7.0/enable" >> /etc/bashrc && \
188
+ source /etc/bashrc && \
189
+ # unzip and install zlog
190
+ gzip -d $ZLOG_VERSION.tar.gz && \
191
+ tar xpf $ZLOG_VERSION.tar && \
192
+ cd zlog-$ZLOG_VERSION && \
193
+ make && make install && \
194
+ echo '/usr/local/lib' >> /etc/ld.so.conf && ldconfig && \
195
+ cd .. && \
196
+ rm -rf $ZLOG_VERSION* && \
197
+ rm -rf zlog-$ZLOG_VERSION && \
198
+ # unzip and install OpenSSL 1.1.1
199
+ gzip -d $OPENSSL_VERSION.tar.gz && \
200
+ tar xpf $OPENSSL_VERSION.tar && \
201
+ cd openssl-$OPENSSL_VERSION && \
202
+ ./config --prefix=/usr/local/openssl && make -j8 && make install && \
203
+ cp /usr/local/openssl/lib/lib* /usr/local/lib/ && \
204
+ cp -r /usr/local/openssl/include/openssl /usr/local/include/ && \
205
+ cd .. && \
206
+ rm -rf $OPENSSL_VERSION* && \
207
+ rm -rf openssl-$OPENSSL_VERSION && \
208
+ ldconfig && \
209
+ # unzip and install PFSD
210
+ gzip -d $PFSD_VERSION.tar.gz && \
211
+ tar xpf $PFSD_VERSION.tar && \
212
+ cd PolarDB-FileSystem-$PFSD_VERSION && \
213
+ sed -i 's/-march=native //' CMakeLists.txt && \
214
+ ./autobuild.sh && ./install.sh && \
215
+ cd .. && \
216
+ rm -rf $PFSD_VERSION* && \
217
+ rm -rf PolarDB-FileSystem-$PFSD_VERSION*
218
+ # add software repository of Node.js LTS
219
+ # @see https://github.com/nodesource/distributions
220
+ # use yarn for documentation development
221
+ RUN curl -fsSL https://rpm.nodesource.com/setup_lts.x | bash - && \
222
+ curl -sL https://dl.yarnpkg.com/rpm/yarn.repo | tee /etc/yum.repos.d/yarn.repo && \
223
+ yum install -y yarn && \
224
+ yum clean all
225
+ # create default user
226
+ ENV USER_NAME=postgres
227
+ RUN echo "create default user" && \
228
+ groupadd -r $USER_NAME && \
229
+ useradd -g $USER_NAME $USER_NAME -p '' && \
230
+ usermod -aG wheel $USER_NAME
231
+ WORKDIR /home/$USER_NAME
232
+ # modify conf
233
+ RUN echo "modify conf" && \
234
+ mkdir -p /var/log/pfs && chown $USER_NAME /var/log/pfs && \
235
+ mkdir -p /var/run/pfs && chown $USER_NAME /var/run/pfs && \
236
+ mkdir -p /var/run/pfsd && chown $USER_NAME /var/run/pfsd && \
237
+ mkdir -p /dev/shm/pfsd && chown $USER_NAME /dev/shm/pfsd && \
238
+ touch /var/run/pfsd/.pfsd && \
239
+ chkconfig --add pfsd_env && \
240
+ echo "ulimit -c unlimited" >> /home/postgres/.bashrc && \
241
+ echo "export PATH=/home/postgres/tmp_basedir_polardb_pg_1100_bld/bin:\$ PATH" >> /home/postgres/.bashrc && \
242
+ echo "alias pg='psql -h /home/postgres/tmp_master_dir_polardb_pg_1100_bld/'" >> /home/postgres/.bashrc && \
243
+ rm /etc/localtime && \
244
+ cp /usr/share/zoneinfo/UTC /etc/localtime && \
245
+ sed -i 's/4096/unlimited/g' /etc/security/limits.d/20-nproc.conf && \
246
+ sed -i 's/vim/vi/g' /root/.bashrc
247
+ USER $USER_NAME
0 commit comments