-
Notifications
You must be signed in to change notification settings - Fork 5
/
Dockerfile-devel-centos7
169 lines (153 loc) · 5.51 KB
/
Dockerfile-devel-centos7
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
FROM centos:centos7
ARG TARGETARCH
LABEL maintainer="[email protected]"
COPY misc/pg_bsd_indent_$TARGETARCH /usr/bin/pg_bsd_indent
CMD bash
ENV PATH="/home/postgres/tmp_polardb_pg_17_base/bin:/home/postgres/tmp_polardb_pg_16_base/bin:/home/postgres/tmp_polardb_pg_15_base/bin:/home/postgres/tmp_basedir_polardb_pg_1100_bld/bin:$PATH"
# avoid missing locale problem
RUN sed -i 's/override_install_langs/# &/' /etc/yum.conf
# add EPEL and scl source
RUN rpmkeys --import file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 && \
yum install -y epel-release centos-release-scl && \
rpmkeys --import file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7 && \
rpmkeys --import file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo && \
yum update -y && \
yum clean all
# GCC and LLVM
RUN yum install -y \
devtoolset-9-gcc \
devtoolset-9-gcc-c++ \
devtoolset-9-gdb \
devtoolset-9-libstdc++-devel \
devtoolset-9-make \
llvm-toolset-7.0-llvm-devel \
llvm-toolset-7.0-clang-devel \
cmake3 && \
yum clean all
# dependencies
RUN yum install -y \
bison \
flex \
fuse-devel \
gettext \
krb5-devel \
krb5-server \
krb5-workstation \
libaio-devel \
libicu-devel \
libunwind-devel \
libuuid-devel \
libxml2-devel \
libxslt-devel \
openldap-clients \
openldap-devel \
openldap-servers \
pam-devel \
perl-DBD-Pg \
perl-Expect \
perl-ExtUtils-Embed \
perl-ExtUtils-MakeMaker \
perl-IPC-Run \
perl-Test-Simple \
protobuf-devel \
python-devel \
readline-devel \
tcl-devel \
xerces-c-devel \
zlib-devel \
&& \
ln /usr/lib64/perl5/CORE/libperl.so /usr/lib64/libperl.so && \
yum clean all
# install basic tools
RUN yum install -y \
git lcov psmisc sudo vim \
less \
net-tools \
python2-psycopg2 \
python2-requests \
tar \
shadow-utils \
which \
binutils \
libtool \
perf \
make sudo \
wget \
util-linux \
rpm-build \
&& \
yum clean all
# set to empty if GitHub is not barriered
# ENV GITHUB_PROXY=https://ghproxy.com/
ENV GITHUB_PROXY=
ENV ZLOG_VERSION=1.2.14
ENV OPENSSL_VERSION=OpenSSL_1_1_1k
ENV PFSD_VERSION=pfsd4pg-release-1.2.42-20220419
# install dependencies from GitHub mirror
RUN cd /usr/local && \
# zlog for PFSD
wget --no-verbose --no-check-certificate "${GITHUB_PROXY}https://github.com/HardySimpson/zlog/archive/refs/tags/${ZLOG_VERSION}.tar.gz" && \
# PFSD
wget --no-verbose --no-check-certificate "${GITHUB_PROXY}https://github.com/ApsaraDB/PolarDB-FileSystem/archive/refs/tags/${PFSD_VERSION}.tar.gz" && \
# OpenSSL 1.1.1
wget --no-verbose --no-check-certificate "${GITHUB_PROXY}https://github.com/openssl/openssl/archive/refs/tags/${OPENSSL_VERSION}.tar.gz" && \
# enable build tools
echo "source /opt/rh/devtoolset-9/enable" >> /etc/bashrc && \
echo "source /opt/rh/llvm-toolset-7.0/enable" >> /etc/bashrc && \
ln -s /usr/bin/cmake3 /usr/bin/cmake && \
source /etc/bashrc && \
# unzip and install zlog
gzip -d $ZLOG_VERSION.tar.gz && \
tar xpf $ZLOG_VERSION.tar && \
cd zlog-$ZLOG_VERSION && \
make && make install && \
echo '/usr/local/lib' >> /etc/ld.so.conf && ldconfig && \
cd .. && \
rm -rf $ZLOG_VERSION* && \
rm -rf zlog-$ZLOG_VERSION && \
# unzip and install PFSD
gzip -d $PFSD_VERSION.tar.gz && \
tar xpf $PFSD_VERSION.tar && \
cd PolarDB-FileSystem-$PFSD_VERSION && \
sed -i 's/-march=native //' CMakeLists.txt && \
./autobuild.sh && ./install.sh && \
cd .. && \
rm -rf $PFSD_VERSION* && \
rm -rf PolarDB-FileSystem-$PFSD_VERSION* && \
# unzip and install OpenSSL 1.1.1
gzip -d $OPENSSL_VERSION.tar.gz && \
tar xpf $OPENSSL_VERSION.tar && \
cd openssl-$OPENSSL_VERSION && \
./config --prefix=/usr/local/openssl && make -j8 && make install && \
cp /usr/local/openssl/lib/lib* /usr/local/lib/ && \
cp -r /usr/local/openssl/include/openssl /usr/local/include/ && \
cd .. && \
rm -rf $OPENSSL_VERSION* && \
rm -rf openssl-$OPENSSL_VERSION && \
ldconfig
# create default user
ENV USER_NAME=postgres
RUN echo "create default user" && \
groupadd -r $USER_NAME && \
useradd -g $USER_NAME $USER_NAME -p '' && \
usermod -aG wheel $USER_NAME
WORKDIR /home/$USER_NAME
# modify conf
RUN echo "modify conf" && \
mkdir -p /var/log/pfs && chown $USER_NAME /var/log/pfs && \
mkdir -p /var/run/pfs && chown $USER_NAME /var/run/pfs && \
mkdir -p /var/run/pfsd && chown $USER_NAME /var/run/pfsd && \
mkdir -p /dev/shm/pfsd && chown $USER_NAME /dev/shm/pfsd && \
touch /var/run/pfsd/.pfsd && \
chkconfig --add pfsd_env && \
echo "ulimit -c unlimited" >> /home/postgres/.bashrc && \
echo "export PGHOST=127.0.0.1" >> /home/postgres/.bashrc && \
echo "export PATH=/home/postgres/tmp_polardb_pg_15_base/bin:\$PATH" >> /home/postgres/.bashrc && \
echo "export PATH=/home/postgres/tmp_polardb_pg_16_base/bin:\$PATH" >> /home/postgres/.bashrc && \
echo "export PATH=/home/postgres/tmp_polardb_pg_17_base/bin:\$PATH" >> /home/postgres/.bashrc && \
rm /etc/localtime && \
cp /usr/share/zoneinfo/UTC /etc/localtime && \
sed -i 's/4096/unlimited/g' /etc/security/limits.d/20-nproc.conf && \
sed -i 's/vim/vi/g' /root/.bashrc
WORKDIR /home/$USER_NAME
USER $USER_NAME