Files
ortools-clone/cmake/docker/opensuse/python.Dockerfile
Corentin Le Molgat 3e6086a363 cmake(ci): add CMAKE_BUILD_PARALLEL_LEVEL support
now build in -j 4 by default
2025-11-18 16:24:39 +01:00

39 lines
1.0 KiB
Docker

FROM ortools/cmake:opensuse_swig AS env
ENV PATH=/root/.local/bin:$PATH
RUN zypper refresh \
&& zypper install -y python3 python3-devel \
python3-pip python3-wheel python3-virtualenv python3-setuptools \
&& zypper clean -a
RUN python3 -m pip install --break-system-packages \
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
RUN cmake -S. -Bbuild -DBUILD_PYTHON=ON -DBUILD_CXX_SAMPLES=OFF -DBUILD_CXX_EXAMPLES=OFF
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 .
RUN python3 -m pip install --break-system-packages *.whl
FROM install_env AS install_devel
COPY cmake/samples/python .
FROM install_devel AS install_build
RUN python3 -m compileall .
FROM install_build AS install_test
RUN python3 sample.py