From 7b9d2ff77e43bb6a5c7e338296dc7c3f7df416d6 Mon Sep 17 00:00:00 2001 From: wuhuizuo Date: Thu, 7 Nov 2024 03:36:50 +0000 Subject: [PATCH 1/4] Revert "fix(dockerfiles/cd/builders/tiflash): update llvm installation steps (#482)" This reverts commit 241664fdff44e6e2eadcac0baa2478af10e6827a. --- dockerfiles/cd/builders/tiflash/Dockerfile | 31 ---------------------- 1 file changed, 31 deletions(-) diff --git a/dockerfiles/cd/builders/tiflash/Dockerfile b/dockerfiles/cd/builders/tiflash/Dockerfile index ff12ada9..49f985b0 100644 --- a/dockerfiles/cd/builders/tiflash/Dockerfile +++ b/dockerfiles/cd/builders/tiflash/Dockerfile @@ -45,37 +45,6 @@ RUN git clone https://github.com/llvm/llvm-project.git --branch llvmorg-17.0.6 ninja -C build install-cxx install-cxxabi install-unwind && \ rm -rf /tmp/llvm-project -# building and reinstall llvm toolsets. -RUN git clone https://github.com/llvm/llvm-project.git --branch llvmorg-17.0.6 --depth 1 /tmp/llvm-project && \ - cd /tmp/llvm-project && rm -rf build && mkdir build && \ - cd build && \ - cmake -DCMAKE_BUILD_TYPE=Release \ - -GNinja \ - -DCMAKE_INSTALL_PREFIX=/usr -DLLVM_LIBDIR_SUFFIX=64 \ - -DLLVM_ENABLE_PROJECTS="clang;lld" \ - -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi" \ - -DLLVM_TARGETS_TO_BUILD=Native \ - ../llvm && \ - ninja && ninja install && \ - \ - cd .. && rm -rf build && mkdir -p build && cd build && \ - cmake -DCMAKE_BUILD_TYPE=Release \ - -GNinja \ - -DCMAKE_INSTALL_PREFIX=/usr -DLLVM_LIBDIR_SUFFIX=64 \ - -DLLVM_ENABLE_PROJECTS="clang;lld;polly;clang-tools-extra;bolt" \ - -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi;openmp;compiler-rt" \ - -DLLVM_TARGETS_TO_BUILD=Native \ - -DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON \ - -DCLANG_DEFAULT_LINKER=lld \ - -DCLANG_DEFAULT_CXX_STDLIB=libc++ \ - -DCMAKE_CXX_COMPILER=clang++ \ - -DCMAKE_C_COMPILER=clang \ - -DLLVM_ENABLE_LIBCXX=ON \ - -DLLVM_ENABLE_LLD=ON \ - -DLIBOMP_LIBFLAGS="-lm" \ - ../llvm && \ - ninja && ninja install && cd ../.. && rm -rf /tmp/llvm-project - # install rust toolchain RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s - -y --default-toolchain none ENV PATH /root/.cargo/bin/:$PATH From bff5f80ef1422708ca54a4e19c3d296213ca4f27 Mon Sep 17 00:00:00 2001 From: wuhuizuo Date: Thu, 7 Nov 2024 03:53:17 +0000 Subject: [PATCH 2/4] feat(dockerfiles/cd/builders/tiflash): update image docker file for new tiflash builder Signed-off-by: wuhuizuo --- dockerfiles/cd/builders/tiflash/Dockerfile | 63 ++++++++----------- .../cd/builders/tiflash/centos7/Dockerfile | 22 +++---- 2 files changed, 37 insertions(+), 48 deletions(-) diff --git a/dockerfiles/cd/builders/tiflash/Dockerfile b/dockerfiles/cd/builders/tiflash/Dockerfile index 49f985b0..5f0004c3 100644 --- a/dockerfiles/cd/builders/tiflash/Dockerfile +++ b/dockerfiles/cd/builders/tiflash/Dockerfile @@ -5,57 +5,46 @@ # - git clone --recurse-submodules https://github.com/pingcap/tiflash.git tiflash # - docker build -t tiflash -f Dockerfile ./tiflash -########### stage: extract-conda-openssl -FROM quay.io/rockylinux/rockylinux:8.10.20240528-ubi as extract-conda-openssl -RUN dnf install -y unzip wget zstd -# install openssl with conda pre-build package. -# index: in https://prefix.dev/channels/conda-forge/packages/openssl -RUN zip_url=$([ "$(arch)" = "x86_64" ] && \ - echo "https://conda.anaconda.org/conda-forge/linux-64/openssl-1.1.1w-hd590300_0.conda" || \ - echo "https://conda.anaconda.org/conda-forge/linux-aarch64/openssl-1.1.1w-h31becfc_0.conda"\ - ); \ - pkg_file=$(basename "$zip_url" .conda); \ - mkdir /output; \ - wget ${zip_url} -O /output/openssl.conda && unzip -d /output /output/openssl.conda && \ - mkdir -p /usr/local/opt/openssl && \ - tar -C /usr/local/opt/openssl -I zstd -xvf /output/pkg-${pkg_file}.tar.zst - ########### stage: builder FROM quay.io/rockylinux/rockylinux:8.10.20240528-ubi as builder LABEL org.opencontainers.image.authors "wuhui.zuo@pingcap.com" LABEL org.opencontainers.image.description "binary builder for TiFlash" LABEL org.opencontainers.image.source "https://github.com/PingCAP-QE/artifacts" -# install packages. -RUN --mount=type=cache,target=/var/cache/dnf \ - dnf upgrade-minimal -y && \ - dnf --enablerepo=powertools install -y git llvm-toolset cmake ninja-build python3.12 libcurl-devel -ENV CC clang -ENV CXX clang++ -ENV LD ld.lld - -# install openssl -COPY --from=extract-conda-openssl /usr/local/opt/openssl /usr/local/opt/openssl -# building and install libc++ -RUN git clone https://github.com/llvm/llvm-project.git --branch llvmorg-17.0.6 --depth 1 /tmp/llvm-project && \ - cd /tmp/llvm-project && rm -rf build && mkdir build && \ - cmake -G Ninja -S runtimes -B build -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi;libunwind" -DCMAKE_INSTALL_PREFIX=/usr -DLLVM_LIBDIR_SUFFIX=64 && \ - ninja -C build cxx cxxabi unwind && \ - ninja -C build install-cxx install-cxxabi install-unwind && \ - rm -rf /tmp/llvm-project +# FIXME: replace with official repo and tag. +# renovate: datasource=github-tags depName=pingcap/tiflash +ARG TIFLASH_REPO=Lloyd-Pottiger/tiflash +ARG TIFLASH_REF=upgarde-build-image +RUN FILE="bake_llvm_base.sh"; \ + TAR_DIR="tiflash-${TIFLASH_REF}"; \ + curl -sSL https://github.com/${TIFLASH_REPO}/archive/refs/heads/${TIFLASH_REF}.tar.gz -o tiflash.tar.gz && \ + tar -zxf tiflash.tar.gz "$TAR_DIR/release-rocky8-llvm/dockerfiles/misc" && \ + pushd "$TAR_DIR/release-rocky8-llvm/dockerfiles/misc" && \ + chmod +x * && ./${FILE} && \ + popd && \ + rm -rf tiflash.tar.gz "$TAR_DIR" + +ENV TZ Asia/Shanghai +RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone + +ENV PATH="/opt/cmake/bin:/usr/local/bin/:${PATH}:/usr/local/go/bin:/root/.cargo/bin" \ + LIBRARY_PATH="/usr/local/lib/$(uname -m)-unknown-linux-gnu/:${LIBRARY_PATH}" \ + LD_LIBRARY_PATH="/usr/local/lib/$(uname -m)-unknown-linux-gnu/:${LD_LIBRARY_PATH}" \ + CPLUS_INCLUDE_PATH="/usr/local/include/$(uname -m)-unknown-linux-gnu/c++/v1/:${CPLUS_INCLUDE_PATH}" \ + OPENSSL_ROOT_DIR="/usr/local/opt/openssl" \ + CC=clang \ + CXX=clang++ \ + LD=ld.lld -# install rust toolchain -RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s - -y --default-toolchain none -ENV PATH /root/.cargo/bin/:$PATH ########### stage: building FROM builder as building ADD . /ws RUN CARGO_NET_GIT_FETCH_WITH_CLI=true /ws/release-centos7-llvm/scripts/build-release.sh -RUN mkdir output && mv /ws/release-centos7-llvm/tiflash output/tiflash -RUN output/tiflash/tiflash version +RUN mkdir /ws/output && mv /ws/release-centos7-llvm/tiflash /ws/output/tiflash +RUN /ws/output/tiflash/tiflash version ########### stage: Final image FROM ghcr.io/pingcap-qe/bases/tiflash-base:v1.9.2 diff --git a/dockerfiles/cd/builders/tiflash/centos7/Dockerfile b/dockerfiles/cd/builders/tiflash/centos7/Dockerfile index a7e74a3a..b31a45ca 100644 --- a/dockerfiles/cd/builders/tiflash/centos7/Dockerfile +++ b/dockerfiles/cd/builders/tiflash/centos7/Dockerfile @@ -2,10 +2,10 @@ # - docker >= v20.10 # # build steps: -# - git clone --recurse-submodules https://github.com/tikv/tikv.git tikv -# - docker build -t tikv -f Dockerfile ./tikv +# - git clone --recurse-submodules https://github.com/pingcap/tiflash.git tiflash +# - docker build -t tiflash -f Dockerfile ./tiflash -########### stage: Builder +########### stage: builder FROM centos:7.9.2009 as builder # CentOS 7 has reached EOL RUN sed -i s/mirror.centos.org/vault.centos.org/g /etc/yum.repos.d/*.repo \ @@ -13,8 +13,8 @@ RUN sed -i s/mirror.centos.org/vault.centos.org/g /etc/yum.repos.d/*.repo \ && sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/*.repo LABEL org.opencontainers.image.authors "wuhui.zuo@pingcap.com" -LABEL org.opencontainers.image.description "binary builder for tiflash" -LABEL org.opencontainers.image.source = "https://github.com/PingCAP-QE/artifacts" +LABEL org.opencontainers.image.description "binary builder for TiFlash" +LABEL org.opencontainers.image.source "https://github.com/PingCAP-QE/artifacts" # renovate: datasource=github-tags depName=pingcap/tiflash ARG TIFLASH_VER=v8.3.0 @@ -32,19 +32,19 @@ ENV CC=clang ENV CXX=clang++ ENV LD=ld.lld -########### stage: Buiding +########### stage: building FROM builder as building -ADD . /tiflash -RUN /tiflash/release-centos7-llvm/scripts/build-release.sh -RUN mkdir output && mv release-centos7-llvm/tiflash output/tiflash -RUN output/tiflash/tiflash version +ADD . /ws +RUN CARGO_NET_GIT_FETCH_WITH_CLI=true /ws/release-centos7-llvm/scripts/build-release.sh +RUN mkdir /ws/output && mv /ws/release-centos7-llvm/tiflash /ws/output/tiflash +RUN /ws/output/tiflash/tiflash version ########### stage: Final image FROM ghcr.io/pingcap-qe/bases/tiflash-base:v1.9.2 ENV LD_LIBRARY_PATH /tiflash -COPY --from=building /tiflash/output/tiflash /tiflash +COPY --from=building /ws/output/tiflash /tiflash ENTRYPOINT ["/tiflash/tiflash", "server"] From af8ffbab98fa1f32ab0a775441af19ab371b27b0 Mon Sep 17 00:00:00 2001 From: wuhuizuo Date: Mon, 11 Nov 2024 20:31:42 +0800 Subject: [PATCH 3/4] Update dockerfiles/cd/builders/tiflash/Dockerfile --- dockerfiles/cd/builders/tiflash/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dockerfiles/cd/builders/tiflash/Dockerfile b/dockerfiles/cd/builders/tiflash/Dockerfile index 5f0004c3..e58d4b15 100644 --- a/dockerfiles/cd/builders/tiflash/Dockerfile +++ b/dockerfiles/cd/builders/tiflash/Dockerfile @@ -14,8 +14,8 @@ LABEL org.opencontainers.image.source "https://github.com/PingCAP-QE/artifacts" # FIXME: replace with official repo and tag. # renovate: datasource=github-tags depName=pingcap/tiflash -ARG TIFLASH_REPO=Lloyd-Pottiger/tiflash -ARG TIFLASH_REF=upgarde-build-image +ARG TIFLASH_REPO=pingcap/tiflash +ARG TIFLASH_REF=master RUN FILE="bake_llvm_base.sh"; \ TAR_DIR="tiflash-${TIFLASH_REF}"; \ curl -sSL https://github.com/${TIFLASH_REPO}/archive/refs/heads/${TIFLASH_REF}.tar.gz -o tiflash.tar.gz && \ From f25872db50e60e62f04d707311d64947c487ab49 Mon Sep 17 00:00:00 2001 From: wuhuizuo Date: Tue, 12 Nov 2024 12:01:33 +0800 Subject: [PATCH 4/4] Update dockerfiles/cd/builders/tiflash/Dockerfile --- dockerfiles/cd/builders/tiflash/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dockerfiles/cd/builders/tiflash/Dockerfile b/dockerfiles/cd/builders/tiflash/Dockerfile index dd2643fb..8b2207ef 100644 --- a/dockerfiles/cd/builders/tiflash/Dockerfile +++ b/dockerfiles/cd/builders/tiflash/Dockerfile @@ -19,8 +19,8 @@ ARG TIFLASH_REF=master RUN FILE="bake_llvm_base.sh"; \ TAR_DIR="tiflash-${TIFLASH_REF}"; \ curl -sSL https://github.com/${TIFLASH_REPO}/archive/refs/heads/${TIFLASH_REF}.tar.gz -o tiflash.tar.gz && \ - tar -zxf tiflash.tar.gz "$TAR_DIR/release-rocky8-llvm/dockerfiles/misc" && \ - pushd "$TAR_DIR/release-rocky8-llvm/dockerfiles/misc" && \ + tar -zxf tiflash.tar.gz "$TAR_DIR/release-linux-llvm/dockerfiles/misc" && \ + pushd "$TAR_DIR/release-linux-llvm/dockerfiles/misc" && \ chmod +x * && ./${FILE} && \ popd && \ rm -rf tiflash.tar.gz "$TAR_DIR"