-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
accd011
commit 0b08edb
Showing
4 changed files
with
153 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,144 @@ | ||
FROM ubuntu:22.04 | ||
LABEL maintainer="[email protected]" | ||
CMD bash | ||
|
||
# Timezone problem | ||
ENV TZ=Asia/Shanghai | ||
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone | ||
|
||
# Upgrade softwares | ||
RUN apt update -y && \ | ||
apt upgrade -y && \ | ||
apt clean -y | ||
|
||
# GCC (force to 9) and LLVM (force to 11) | ||
RUN apt install -y \ | ||
gcc-9 \ | ||
g++-9 \ | ||
llvm-11-dev \ | ||
clang-11 \ | ||
make \ | ||
gdb \ | ||
pkg-config \ | ||
locales && \ | ||
update-alternatives --install \ | ||
/usr/bin/gcc gcc /usr/bin/gcc-9 60 --slave \ | ||
/usr/bin/g++ g++ /usr/bin/g++-9 && \ | ||
update-alternatives --install \ | ||
/usr/bin/llvm-config llvm-config /usr/bin/llvm-config-11 60 --slave \ | ||
/usr/bin/clang++ clang++ /usr/bin/clang++-11 --slave \ | ||
/usr/bin/clang clang /usr/bin/clang-11 && \ | ||
apt clean -y | ||
|
||
# Generate locale | ||
RUN sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && \ | ||
sed -i '/zh_CN.UTF-8/s/^# //g' /etc/locale.gen && \ | ||
locale-gen | ||
|
||
# Dependencies | ||
RUN apt install -y \ | ||
libicu-dev \ | ||
bison \ | ||
flex \ | ||
python3-dev \ | ||
libreadline-dev \ | ||
libgss-dev \ | ||
libssl-dev \ | ||
libpam0g-dev \ | ||
libxml2-dev \ | ||
libxslt1-dev \ | ||
libldap2-dev \ | ||
uuid-dev \ | ||
liblz4-dev \ | ||
libkrb5-dev \ | ||
gettext \ | ||
libxerces-c-dev \ | ||
tcl-dev \ | ||
libperl-dev \ | ||
libipc-run-perl \ | ||
libaio-dev \ | ||
libfuse-dev && \ | ||
apt clean -y | ||
|
||
# Tools | ||
RUN apt install -y \ | ||
iproute2 \ | ||
wget \ | ||
ccache \ | ||
sudo \ | ||
vim \ | ||
git \ | ||
cmake && \ | ||
apt clean -y | ||
|
||
# PostGIS | ||
RUN apt install -y \ | ||
libgeos-dev \ | ||
libproj-dev \ | ||
libgdal-dev \ | ||
libprotobuf-c-dev \ | ||
protobuf-compiler \ | ||
protobuf-c-compiler && \ | ||
apt clean -y | ||
|
||
# set to empty if GitHub is not barriered | ||
# ENV GITHUB_PROXY=https://ghproxy.com/ | ||
ENV GITHUB_PROXY= | ||
|
||
ENV ZLOG_VERSION=1.2.14 | ||
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" && \ | ||
# 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* | ||
|
||
# add software repository of Node.js LTS | ||
# @see https://github.com/nodesource/distributions | ||
# use yarn for documentation development | ||
# RUN curl -fsSL https://deb.nodesource.com/setup_lts.x | bash - && \ | ||
# apt install -y nodejs && \ | ||
# apt clean -y && \ | ||
# corepack enable && corepack prepare yarn@stable --activate | ||
|
||
# create default user | ||
ENV USER_NAME=postgres | ||
RUN echo "create default user" && \ | ||
groupadd -r $USER_NAME && \ | ||
useradd -ms /bin/bash -g $USER_NAME $USER_NAME -p '' && \ | ||
usermod -aG sudo $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 && \ | ||
echo "ulimit -c unlimited" >> /home/postgres/.bashrc && \ | ||
echo "export PGHOST=127.0.0.1" >> /home/postgres/.bashrc && \ | ||
echo "alias pg='psql -h /home/postgres/tmp_master_dir_polardb_pg_1100_bld/'" >> /home/postgres/.bashrc | ||
|
||
ENV PATH="/home/postgres/tmp_basedir_polardb_pg_1100_bld/bin:$PATH" | ||
WORKDIR /home/$USER_NAME | ||
USER $USER_NAME |