Files
ortools-clone/cmake/docker/system_deps/python.Dockerfile

50 lines
1.3 KiB
Docker
Raw Permalink Normal View History

FROM ortools/cmake:system_deps_swig AS env
2024-07-22 13:53:01 +02:00
ENV PATH=/root/.local/bin:$PATH
#RUN pacman -Syu --noconfirm pybind11
2022-07-28 10:48:14 +02:00
RUN pacman -Syu --noconfirm python \
2022-09-30 00:18:52 +02:00
python-setuptools python-wheel python-virtualenv \
python-pip python-protobuf python-numpy python-pandas
RUN python -m pip install --break-system-package \
absl-py mypy mypy-protobuf
FROM env AS devel
WORKDIR /home/project
COPY . .
ARG CMAKE_BUILD_PARALLEL_LEVEL
ENV CMAKE_BUILD_PARALLEL_LEVEL=${CMAKE_BUILD_PARALLEL_LEVEL:-4}
FROM devel AS build
# Archlinux do not provide pybind11 protobuf package
RUN cmake -S. -Bbuild -DBUILD_DEPS=OFF \
-DBUILD_pybind11=ON \
2024-07-18 18:47:55 +02:00
-DBUILD_pybind11_abseil=ON \
-DBUILD_pybind11_protobuf=ON \
-DUSE_COINOR=ON \
-DUSE_GLPK=ON \
-DUSE_HIGHS=OFF \
-DUSE_SCIP=ON \
-DBUILD_PYTHON=ON \
-DBUILD_CXX_SAMPLES=OFF -DBUILD_CXX_EXAMPLES=OFF \
-DBUILD_googletest=ON
RUN cmake --build build --target all -v
RUN cmake --build build --target install
FROM build AS test
RUN CTEST_OUTPUT_ON_FAILURE=1 cmake --build build --target test
FROM env AS install_env
WORKDIR /home/sample
COPY --from=build /home/project/build/python/dist/*.whl .
2024-11-21 09:34:20 +01:00
RUN python -m pip install --break-system-packages *.whl
FROM install_env AS install_devel
COPY cmake/samples/python .
FROM install_devel AS install_build
RUN python -m compileall .
FROM install_build AS install_test
RUN python sample.py