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

40 lines
1.1 KiB
Docker
Raw Normal View History

FROM ortools/cmake:ubuntu_swig AS env
2024-07-22 13:53:01 +02:00
2020-11-30 21:12:51 +01:00
ENV PATH=/root/.local/bin:$PATH
2020-03-30 12:53:42 +02:00
RUN apt-get update -qq \
2023-06-05 08:12:25 +02:00
&& DEBIAN_FRONTEND=noninteractive apt-get install -yq \
python3-dev python3-pip \
2024-11-15 09:57:34 +01:00
python3-setuptools python3-wheel \
python3-venv python3-virtualenv \
2025-05-12 12:57:50 +02:00
python3-numpy python3-pandas \
2020-03-30 12:53:42 +02:00
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
2023-06-05 08:12:25 +02:00
RUN python3 -m pip install --break-system-package \
2025-05-12 12:57:50 +02:00
absl-py mypy mypy-protobuf typing-extensions
2020-03-30 12:53:42 +02:00
FROM env AS devel
WORKDIR /home/project
2020-03-30 12:53:42 +02:00
COPY . .
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
2020-03-30 12:53:42 +02:00
RUN cmake --build build --target install
FROM build AS test
RUN CTEST_OUTPUT_ON_FAILURE=1 cmake --build build --target test
2020-03-30 12:53:42 +02:00
FROM env AS install_env
WORKDIR /home/sample
COPY --from=build /home/project/build/python/dist/*.whl .
2023-06-05 08:12:25 +02:00
RUN python3 -m pip install --break-system-packages *.whl
2020-03-30 12:53:42 +02:00
FROM install_env AS install_devel
COPY cmake/samples/python .
2020-03-30 12:53:42 +02:00
FROM install_devel AS install_build
RUN python3 -m compileall .
2020-03-30 12:53:42 +02:00
FROM install_build AS install_test
RUN python3 sample.py