Skip to content

Commit

Permalink
feat: add Ubuntu 22.04 base image
Browse files Browse the repository at this point in the history
  • Loading branch information
mrdrivingduck committed Oct 22, 2023
1 parent accd011 commit 0b08edb
Show file tree
Hide file tree
Showing 4 changed files with 153 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-and-publish-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
base_image: [ centos7 ]
base_image: [ centos7, ubuntu22.04 ]
steps:
# Checkout source code
-
Expand Down
8 changes: 4 additions & 4 deletions Dockerfile-devel-centos7
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,10 @@ RUN cd /usr/local && \
# add software repository of Node.js LTS
# @see https://github.com/nodesource/distributions
# use yarn for documentation development
RUN curl -fsSL https://rpm.nodesource.com/setup_16.x | bash - && \
curl -sL https://dl.yarnpkg.com/rpm/yarn.repo | tee /etc/yum.repos.d/yarn.repo && \
yum install -y yarn && \
yum clean all
# RUN curl -fsSL https://rpm.nodesource.com/setup_16.x | bash - && \
# curl -sL https://dl.yarnpkg.com/rpm/yarn.repo | tee /etc/yum.repos.d/yarn.repo && \
# yum install -y yarn && \
# yum clean all

# create default user
ENV USER_NAME=postgres
Expand Down
8 changes: 4 additions & 4 deletions Dockerfile-devel-ubuntu20.04
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,10 @@ RUN cd /usr/local && \
# 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
# 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
Expand Down
144 changes: 144 additions & 0 deletions Dockerfile-devel-ubuntu22.04
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

0 comments on commit 0b08edb

Please sign in to comment.