-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.python_build
56 lines (42 loc) · 1.76 KB
/
Dockerfile.python_build
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
FROM quay.io/pypa/manylinux_2_28_x86_64
# Install CMake and other necessary tools
RUN yum install -y cmake make curl zip unzip tar git gcc openssl-devel bzip2-devel libffi-devel zlib-devel readline-devel sqlite-devel xz xz-devel patch which
# Install pyenv
RUN curl https://pyenv.run | bash
# Set environment variables for pyenv
ENV PYENV_ROOT="/root/.pyenv"
ENV PATH="$PYENV_ROOT/bin:$PATH"
# Initialize pyenv in the shell
RUN echo 'eval "$(pyenv init --path)"' >> ~/.bashrc
RUN echo 'eval "$(pyenv init -)"' >> ~/.bashrc
RUN echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.bashrc
# Install Python 3.10.12 using pyenv
RUN /bin/bash -c "source ~/.bashrc && pyenv install 3.10.12 && pyenv global 3.10.12"
# Install Python 3.12.3 using pyenv
RUN /bin/bash -c "pyenv install 3.12.3"
# Install vcpkg
RUN git clone https://github.com/Microsoft/vcpkg.git /opt/vcpkg && \
/opt/vcpkg/bootstrap-vcpkg.sh
ENV VCPKG_ROOT=/opt/vcpkg
ENV PATH="${VCPKG_ROOT}:${PATH}"
# Ensure pip is installed and up to date
RUN python3.10 -m ensurepip --upgrade && \
python3.10 -m pip install --upgrade pip pybind11 twine auditwheel setuptools wheel
# Set working directory
WORKDIR /src
# Copy necessary files and directories
COPY CMakeLists.txt vcpkg.json build_python_package_in_docker.sh /src/
COPY lib /src/lib
COPY app /src/app
COPY python_bindings /src/python_bindings
# Install dependencies using vcpkg
RUN vcpkg install
# Set library path
ENV LD_LIBRARY_PATH="/usr/local/lib:${LD_LIBRARY_PATH}"
# Build the main project
RUN mkdir -p /src/build-python-bindings && \
cd /src/build-python-bindings && \
cmake .. \
-DCMAKE_TOOLCHAIN_FILE=${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake \
-DCMAKE_VERBOSE_MAKEFILE=ON && \
make VERBOSE=1