From 0b08edb39fee86409e0d15e76f9428ad7780404a Mon Sep 17 00:00:00 2001 From: mrdrivingduck Date: Sun, 22 Oct 2023 11:48:48 +0800 Subject: [PATCH] feat: add Ubuntu 22.04 base image --- .../workflows/build-and-publish-images.yml | 2 +- Dockerfile-devel-centos7 | 8 +- Dockerfile-devel-ubuntu20.04 | 8 +- Dockerfile-devel-ubuntu22.04 | 144 ++++++++++++++++++ 4 files changed, 153 insertions(+), 9 deletions(-) create mode 100644 Dockerfile-devel-ubuntu22.04 diff --git a/.github/workflows/build-and-publish-images.yml b/.github/workflows/build-and-publish-images.yml index f93f2bd..9e0d388 100644 --- a/.github/workflows/build-and-publish-images.yml +++ b/.github/workflows/build-and-publish-images.yml @@ -43,7 +43,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - base_image: [ centos7 ] + base_image: [ centos7, ubuntu22.04 ] steps: # Checkout source code - diff --git a/Dockerfile-devel-centos7 b/Dockerfile-devel-centos7 index 917cf08..231d1ee 100644 --- a/Dockerfile-devel-centos7 +++ b/Dockerfile-devel-centos7 @@ -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 diff --git a/Dockerfile-devel-ubuntu20.04 b/Dockerfile-devel-ubuntu20.04 index 45eb231..aff8323 100644 --- a/Dockerfile-devel-ubuntu20.04 +++ b/Dockerfile-devel-ubuntu20.04 @@ -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 diff --git a/Dockerfile-devel-ubuntu22.04 b/Dockerfile-devel-ubuntu22.04 new file mode 100644 index 0000000..a183bd0 --- /dev/null +++ b/Dockerfile-devel-ubuntu22.04 @@ -0,0 +1,144 @@ +FROM ubuntu:22.04 +LABEL maintainer="mrdrivingduck@gmail.com" +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