Skip to content

Commit

Permalink
Added python venv into CentOS 7 builder image (#1169)
Browse files Browse the repository at this point in the history
Added python venv into CentOS 7 builder image to let slow_test happy

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
  • Loading branch information
yuzhichang authored May 6, 2024
1 parent bb0821e commit e6b7352
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/slow_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
- name: Build release version
if: ${{ !cancelled() && !failure() }}
run: sudo docker exec infinity_build bash -c "git config --global safe.directory \"*\" && cd /infinity && rm -fr cmake-build-release && mkdir -p cmake-build-release && cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_JOB_POOL_LINK:STRING=link_pool -DCMAKE_JOB_POOLS:STRING=link_pool=1 -S /infinity -B /infinity/cmake-build-release && cmake --build /infinity/cmake-build-release"
run: sudo docker exec infinity_build bash -c "git config --global safe.directory \"*\" && cd /infinity && rm -fr cmake-build-release && mkdir -p cmake-build-release && cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_JOB_POOL_LINK:STRING=link_pool -DCMAKE_JOB_POOLS:STRING=link_pool=2 -S /infinity -B /infinity/cmake-build-release && cmake --build /infinity/cmake-build-release"

- name: Install pysdk
if: ${{ !cancelled() && !failure() }}
Expand Down
33 changes: 33 additions & 0 deletions scripts/Dockerfile_infinity_builder_centos7
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
# lz4-1.9.4.tar.gz
# jemalloc-5.3.0.tar.bz2
# gperftools-2.15.tar.gz
# openssl-1.1.1w.tar.gz
# Python-3.12.3.tar.xz

FROM centos:7

Expand Down Expand Up @@ -128,6 +130,37 @@ RUN --mount=type=bind,source=gperftools-2.15.tar.gz,target=/root/gperftools-2.15
&& cd gperftools-2.15 && ./configure && make -j 8 && make install \
&& ldconfig && cd /root && rm -rf gperftools-2.15

# OpenSSL
# pyhton 3.6+ ssl module requires openssl 1.1.1+
# "OpenSSL 1.1.x is not fully source compatible with OpenSSL 1.0.2." refers to https://github.com/openssl/openssl/issues/9772.
# This means installing to /usr/local/lib may break app compilation.
RUN --mount=type=bind,source=openssl-1.1.1w.tar.gz,target=/root/openssl-1.1.1w.tar.gz \
cd /root && tar xzf openssl-1.1.1w.tar.gz \
&& cd openssl-1.1.1w && ./config --prefix=/usr/local/openssl --openssldir=/usr/local/openssl shared \
&& make -j 8 && make install \
&& ldconfig && cd /root && rm -rf openssl-1.1.1w

# packages need by python optional modules: _dbm _gdbm _lzma _sqlite3 _tkinter _uuid
# Too old: ncurses-devel sqlite-devel
# TODO: failed to build ncurses 5.4, 5.7, 5.9
RUN yum install -y gdbm-devel sqlite-devel xz-devel tk-devel libffi-devel libuuid-devel bzip2-devel readline-devel tk-devel \
&& yum clean all

# Install Python 3.12
RUN --mount=type=bind,source=Python-3.12.3.tar.xz,target=/root/Python-3.12.3.tar.xz \
cd /root && tar xJf Python-3.12.3.tar.xz \
&& cd Python-3.12.3 && ./configure --with-openssl=/usr/local/openssl --with-openssl-rpath=auto --enable-shared && make -j 8 && make install \
&& ldconfig && cd /root && rm -rf Python-3.12.3

# Create a python virtual environment. Set PATH so that the shell activate this virtual environment automatically when entering a container from this image.
RUN /usr/local/bin/python3 -m venv /usr/local/venv
ENV PATH="/usr/local/venv/bin:/usr/local/bin:$PATH"
RUN pip3 config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple/ && pip3 config set global.trusted-host pypi.tuna.tsinghua.edu.cn && pip3 install wheel twine

# infinity python SDK dependencies
COPY python/requirements.txt .
RUN --mount=type=bind,source=python/requirements.txt,target=/root/requirements.txt pip3 install --no-input -r /root/requirements.txt

ENV CC=clang CXX=clang++ LZ4_ROOT=/usr/local

ENTRYPOINT [ "bash", "-c", "while true; do sleep 60; done"]
18 changes: 4 additions & 14 deletions scripts/download_deps_infinity_builder_centos7.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,5 @@
#!/usr/bin/env bash

# This script will download the following files:
# bison-3.8.2.tar.xz
# binutils-2.41.tar.xz
# gcc-13.2.0.tar.xz
# cmake-3.29.0-linux-x86_64.tar.gz
# ninja-linux.zip
# llvm-project-17.0.6.src.tar.xz
# boost_1_81_0.tar.bz2
# flex-2.6.4.tar.gz
# liburing-2.5.tar.gz
# libevent-2.1.12-stable.tar.gz
# lz4-1.9.4.tar.gz

download()
{
echo "download $1"
Expand All @@ -35,7 +22,10 @@ https://github.com/westes/flex/releases/download/v2.6.4/flex-2.6.4.tar.gz
https://github.com/axboe/liburing/archive/refs/tags/liburing-2.5.tar.gz
https://github.com/libevent/libevent/releases/download/release-2.1.12-stable/libevent-2.1.12-stable.tar.gz
https://github.com/lz4/lz4/releases/download/v1.9.4/lz4-1.9.4.tar.gz
https://github.com/jemalloc/jemalloc/releases/download/5.3.0/jemalloc-5.3.0.tar.bz2"
https://github.com/jemalloc/jemalloc/releases/download/5.3.0/jemalloc-5.3.0.tar.bz2
https://github.com/gperftools/gperftools/releases/download/gperftools-2.15/gperftools-2.15.tar.gz
https://github.com/openssl/openssl/releases/download/OpenSSL_1_1_1w/openssl-1.1.1w.tar.gz
https://www.python.org/ftp/python/3.12.3/Python-3.12.3.tar.xz"

SAVEIFS=$IFS # Save current IFS (Internal Field Separator)
IFS=$'\n' # Change IFS to newline char
Expand Down

0 comments on commit e6b7352

Please sign in to comment.