diff --git a/tools/docker/Makefile b/tools/docker/Makefile index 9a2bf095b2..38ee983f3f 100644 --- a/tools/docker/Makefile +++ b/tools/docker/Makefile @@ -484,6 +484,7 @@ define build_lang_distro = $$(foreach stage,${LANG_STAGES},$$(eval $$(call build_lang_stage,$1,$2,cpp,$${stage}))) $$(foreach stage,${LANG_STAGES},$$(eval $$(call build_lang_stage,$1,$2,dotnet,$${stage}))) $$(foreach stage,${LANG_STAGES},$$(eval $$(call build_lang_stage,$1,$2,java,$${stage}))) +$$(foreach stage,${LANG_STAGES},$$(eval $$(call build_lang_stage,$1,$2,python,$${stage}))) endef define build_lang_platform = @@ -554,18 +555,24 @@ $$(foreach stage,${STAGES} export,$$(eval $$(call merge_stage,$1,$${stage}))) $$(foreach stage,${LANG_STAGES} export,$$(eval $$(call merge_stage,$1,cpp_$${stage}))) $$(foreach stage,${LANG_STAGES} export,$$(eval $$(call merge_stage,$1,dotnet_$${stage}))) $$(foreach stage,${LANG_STAGES} export,$$(eval $$(call merge_stage,$1,java_$${stage}))) +$$(foreach stage,${LANG_STAGES} export,$$(eval $$(call merge_stage,$1,python_$${stage}))) build_targets := $(addprefix $1_, ${STAGES} export) \ $(addprefix $1_cpp_, ${LANG_STAGES} export) \ $(addprefix $1_dotnet_, ${LANG_STAGES} export) \ - $(addprefix $1_java_, ${LANG_STAGES} export) + $(addprefix $1_java_, ${LANG_STAGES} export) \ + $(addprefix $1_python_, ${LANG_STAGES} export) .PHONY: $${build_targets} $${build_targets}: $1_%: $(addprefix $1_, $(addsuffix _%, ${DISTROS})) +.PHONY: $1_export +$1_export: $1_cpp_export $1_dotnet_export $1_java_export $1_python_export + clean_targets := $(addprefix clean_$1_, ${STAGES} export) \ $(addprefix clean_$1_cpp_, ${LANG_STAGES} export) \ $(addprefix clean_$1_dotnet_, ${LANG_STAGES} export) \ - $(addprefix clean_$1_java_, ${LANG_STAGES} export) + $(addprefix clean_$1_java_, ${LANG_STAGES} export) \ + $(addprefix clean_$1_python_, ${LANG_STAGES} export) .PHONY: $${clean_targets} $${clean_targets}: clean_$1_%: $(addprefix clean_$1_, $(addsuffix _%, ${DISTROS})) diff --git a/tools/docker/test/alpine-edge/python.Dockerfile b/tools/docker/test/alpine-edge/python.Dockerfile new file mode 100644 index 0000000000..feba0b34cf --- /dev/null +++ b/tools/docker/test/alpine-edge/python.Dockerfile @@ -0,0 +1,20 @@ +# Create a virtual environment with all tools installed +# ref: https://hub.docker.com/_/alpine +FROM alpine:edge AS env + +############# +## SETUP ## +############# +ENV PATH=/usr/local/bin:$PATH +RUN apk add --no-cache make + +# Install Python +RUN apk add --no-cache python3-dev py3-pip py3-wheel py3-numpy +RUN python3 -m pip install absl-py mypy-protobuf +ENTRYPOINT ["/bin/sh", "-c"] +CMD ["/bin/sh"] + +WORKDIR /root +ADD or-tools_amd64_alpine-edge_python_v*.tar.gz . + +RUN cd or-tools_*_v* && make test diff --git a/tools/docker/test/archlinux/python.Dockerfile b/tools/docker/test/archlinux/python.Dockerfile new file mode 100644 index 0000000000..adafc4b8ff --- /dev/null +++ b/tools/docker/test/archlinux/python.Dockerfile @@ -0,0 +1,20 @@ +# Create a virtual environment with all tools installed +# ref: https://hub.docker.com/_/archlinux/ +FROM archlinux:latest AS env + +############# +## SETUP ## +############# +ENV PATH=/usr/local/bin:$PATH +RUN pacman -Syu --noconfirm make +ENTRYPOINT ["/bin/bash", "-c"] +CMD [ "/bin/bash" ] + +# Install Python +RUN pacman -Syu --noconfirm python python-pip python-numpy +RUN python -m pip install absl-py mypy-protobuf + +WORKDIR /root +ADD or-tools_amd64_alpine-edge_python_v*.tar.gz . + +RUN cd or-tools_*_v* && make test diff --git a/tools/docker/test/centos-7/python.Dockerfile b/tools/docker/test/centos-7/python.Dockerfile new file mode 100644 index 0000000000..9f2b6cd656 --- /dev/null +++ b/tools/docker/test/centos-7/python.Dockerfile @@ -0,0 +1,21 @@ +# ref: https://hub.docker.com/_/centos +FROM centos:7 + +############# +## SETUP ## +############# +RUN yum -y update \ +&& yum -y groupinstall 'Development Tools' \ +&& yum clean all \ +&& rm -rf /var/cache/yum + +# Install Python +RUN yum -y update \ +&& yum -y install python3 python3-devel python3-pip numpy \ +&& yum clean all \ +&& rm -rf /var/cache/yum + +WORKDIR /root +ADD or-tools_amd64_centos-7_python_v*.tar.gz . + +RUN cd or-tools_*_v* && make test diff --git a/tools/docker/test/centos-8/python.Dockerfile b/tools/docker/test/centos-8/python.Dockerfile new file mode 100644 index 0000000000..ac4b5fe20d --- /dev/null +++ b/tools/docker/test/centos-8/python.Dockerfile @@ -0,0 +1,18 @@ +# ref: https://quay.io/repository/centos/centos +FROM quay.io/centos/centos:stream8 + +RUN dnf -y update \ +&& dnf -y groupinstall 'Development Tools' \ +&& dnf clean all \ +&& rm -rf /var/cache/dnf + +# Install Python +RUN dnf -y update \ +&& dnf -y install python3 python3-devel python3-pip \ +&& dnf clean all \ +&& rm -rf /var/cache/dnf + +WORKDIR /root +ADD or-tools_amd64_centos-8_python_v*.tar.gz . + +RUN cd or-tools_*_v* && make test diff --git a/tools/docker/test/debian-10/python.Dockerfile b/tools/docker/test/debian-10/python.Dockerfile new file mode 100644 index 0000000000..4e991a5ae4 --- /dev/null +++ b/tools/docker/test/debian-10/python.Dockerfile @@ -0,0 +1,21 @@ +# ref: https://hub.docker.com/_/debian +FROM debian:10 + +RUN apt-get update \ +&& apt-get install -y -q build-essential zlib1g-dev \ +&& apt-get clean \ +&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* +ENTRYPOINT ["/bin/bash", "-c"] +CMD ["/bin/bash"] + +# Install CMake 3.21.1 +RUN ARCH=$(uname -m) \ +&& wget -q "https://cmake.org/files/v3.21/cmake-3.21.1-linux-${ARCH}.sh" \ +&& chmod a+x cmake-3.21.1-linux-${ARCH}.sh \ +&& ./cmake-3.21.1-linux-${ARCH}.sh --prefix=/usr/local/ --skip-license \ +&& rm cmake-3.21.1-linux-${ARCH}.sh + +WORKDIR /root +ADD or-tools_amd64_debian-10_python_v*.tar.gz . + +RUN cd or-tools_*_v* && make test diff --git a/tools/docker/test/debian-11/python.Dockerfile b/tools/docker/test/debian-11/python.Dockerfile new file mode 100644 index 0000000000..6f8a4749d0 --- /dev/null +++ b/tools/docker/test/debian-11/python.Dockerfile @@ -0,0 +1,21 @@ +# ref: https://hub.docker.com/_/debian +FROM debian:11 + +RUN apt-get update \ +&& apt-get install -y -q build-essential zlib1g-dev \ +&& apt-get clean \ +&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* +ENTRYPOINT ["/bin/bash", "-c"] +CMD ["/bin/bash"] + +# Install CMake 3.21.1 +RUN ARCH=$(uname -m) \ +&& wget -q "https://cmake.org/files/v3.21/cmake-3.21.1-linux-${ARCH}.sh" \ +&& chmod a+x cmake-3.21.1-linux-${ARCH}.sh \ +&& ./cmake-3.21.1-linux-${ARCH}.sh --prefix=/usr/local/ --skip-license \ +&& rm cmake-3.21.1-linux-${ARCH}.sh + +WORKDIR /root +ADD or-tools_amd64_debian-11_python_v*.tar.gz . + +RUN cd or-tools_*_v* && make test diff --git a/tools/docker/test/fedora-33/python.Dockerfile b/tools/docker/test/fedora-33/python.Dockerfile new file mode 100644 index 0000000000..963d1136e6 --- /dev/null +++ b/tools/docker/test/fedora-33/python.Dockerfile @@ -0,0 +1,14 @@ +# ref: https://hub.docker.com/_/fedora +FROM fedora:33 + +RUN dnf -y update \ +&& dnf -y install git \ + wget which redhat-lsb-core pkgconfig autoconf libtool zlib-devel \ +&& dnf -y groupinstall "Development Tools" \ +&& dnf -y install gcc-c++ cmake \ +&& dnf clean all + +WORKDIR /root +ADD or-tools_amd64_fedora-33_python_v*.tar.gz . + +RUN cd or-tools_*_v* && make test diff --git a/tools/docker/test/fedora-34/python.Dockerfile b/tools/docker/test/fedora-34/python.Dockerfile new file mode 100644 index 0000000000..a2594b2d01 --- /dev/null +++ b/tools/docker/test/fedora-34/python.Dockerfile @@ -0,0 +1,14 @@ +# ref: https://hub.docker.com/_/fedora +FROM fedora:34 + +RUN dnf -y update \ +&& dnf -y install git \ + wget which redhat-lsb-core pkgconfig autoconf libtool zlib-devel \ +&& dnf -y groupinstall "Development Tools" \ +&& dnf -y install gcc-c++ cmake \ +&& dnf clean all + +WORKDIR /root +ADD or-tools_amd64_fedora-34_python_v*.tar.gz . + +RUN cd or-tools_*_v* && make test diff --git a/tools/docker/test/fedora-35/python.Dockerfile b/tools/docker/test/fedora-35/python.Dockerfile new file mode 100644 index 0000000000..7854dd299d --- /dev/null +++ b/tools/docker/test/fedora-35/python.Dockerfile @@ -0,0 +1,14 @@ +# ref: https://hub.docker.com/_/fedora +FROM fedora:35 + +RUN dnf -y update \ +&& dnf -y install git \ + wget which redhat-lsb-core pkgconfig autoconf libtool zlib-devel \ +&& dnf -y groupinstall "Development Tools" \ +&& dnf -y install gcc-c++ cmake \ +&& dnf clean all + +WORKDIR /root +ADD or-tools_amd64_fedora-35_python_v*.tar.gz . + +RUN cd or-tools_*_v* && make test diff --git a/tools/docker/test/fedora-36/python.Dockerfile b/tools/docker/test/fedora-36/python.Dockerfile new file mode 100644 index 0000000000..d38be1802f --- /dev/null +++ b/tools/docker/test/fedora-36/python.Dockerfile @@ -0,0 +1,14 @@ +# ref: https://hub.docker.com/_/fedora +FROM fedora:36 + +RUN dnf -y update \ +&& dnf -y install git \ + wget which redhat-lsb-core pkgconfig autoconf libtool zlib-devel \ +&& dnf -y groupinstall "Development Tools" \ +&& dnf -y install gcc-c++ cmake \ +&& dnf clean all + +WORKDIR /root +ADD or-tools_amd64_fedora-36_python_v*.tar.gz . + +RUN cd or-tools_*_v* && make test diff --git a/tools/docker/test/opensuse-leap/python.Dockerfile b/tools/docker/test/opensuse-leap/python.Dockerfile new file mode 100644 index 0000000000..f432f6a0c0 --- /dev/null +++ b/tools/docker/test/opensuse-leap/python.Dockerfile @@ -0,0 +1,22 @@ +# Create a virtual environment with all tools installed +# ref: https://hub.docker.com/r/opensuse/leap +FROM opensuse/leap + +# Install system build dependencies +ENV PATH=/usr/local/bin:$PATH +RUN zypper refresh \ +&& zypper install -y make \ +&& zypper clean -a +ENV CC=gcc-11 CXX=g++-11 +ENTRYPOINT ["/usr/bin/bash", "-c"] +CMD ["/usr/bin/bash"] + +# Python Install +RUN zypper install -y python3-devel python3-pip python3-wheel \ +&& zypper clean -a +RUN python3 -m pip install absl-py mypy-protobuf + +WORKDIR /root +ADD or-tools_amd64_opensuse-leap_python_v*.tar.gz . + +RUN cd or-tools_*_v* && make test diff --git a/tools/docker/test/ubuntu-18.04/python.Dockerfile b/tools/docker/test/ubuntu-18.04/python.Dockerfile new file mode 100644 index 0000000000..2292e41089 --- /dev/null +++ b/tools/docker/test/ubuntu-18.04/python.Dockerfile @@ -0,0 +1,12 @@ +# ref: https://hub.docker.com/_/ubuntu +FROM ubuntu:18.04 + +RUN apt-get update \ +&& apt-get install -yq make \ +&& apt-get clean \ +&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +WORKDIR /root +ADD or-tools_amd64_ubuntu-18.04_python_v*.tar.gz . + +RUN cd or-tools_*_v* && make test diff --git a/tools/docker/test/ubuntu-20.04/python.Dockerfile b/tools/docker/test/ubuntu-20.04/python.Dockerfile new file mode 100644 index 0000000000..b68292cb53 --- /dev/null +++ b/tools/docker/test/ubuntu-20.04/python.Dockerfile @@ -0,0 +1,15 @@ +# ref: https://hub.docker.com/_/ubuntu +FROM ubuntu:20.04 + +ENV DEBIAN_FRONTEND=noninteractive +RUN apt-get update \ +&& apt-get install -yq make \ +&& apt-get clean \ +&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* +ENTRYPOINT ["/bin/bash", "-c"] +CMD ["/bin/bash"] + +WORKDIR /root +ADD or-tools_amd64_ubuntu-20.04_python_v*.tar.gz . + +RUN cd or-tools_*_v* && make test diff --git a/tools/docker/test/ubuntu-22.04/python.Dockerfile b/tools/docker/test/ubuntu-22.04/python.Dockerfile new file mode 100644 index 0000000000..0d88044fea --- /dev/null +++ b/tools/docker/test/ubuntu-22.04/python.Dockerfile @@ -0,0 +1,13 @@ +# ref: https://hub.docker.com/_/ubuntu +FROM ubuntu:22.04 + +ENV DEBIAN_FRONTEND=noninteractive +RUN apt-get update -qq \ +&& apt-get install -yq make \ +&& apt-get clean \ +&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +WORKDIR /root +ADD or-tools_amd64_ubuntu-22.04_python_v*.tar.gz . + +RUN cd or-tools_*_v* && make test