From 9ab122d80766249c45f729fb2d2154a6a1dbc80a Mon Sep 17 00:00:00 2001 From: Mizux Seiha Date: Tue, 6 Oct 2020 14:27:00 +0200 Subject: [PATCH] tools(docker): Update Ubuntu support (Fix #2188) * Add Ubuntu 20.10 * Remove Ubuntu 16.04 LTS * Remove Ubuntu 19.10 --- tools/docker/Makefile | 5 +- tools/docker/test/ubuntu-16.04/cc.Dockerfile | 32 ------ .../test/ubuntu-16.04/dotnet.Dockerfile | 45 -------- .../docker/test/ubuntu-16.04/java.Dockerfile | 33 ------ tools/docker/test/ubuntu-19.10/cc.Dockerfile | 14 --- .../docker/test/ubuntu-19.10/java.Dockerfile | 15 --- tools/docker/test/ubuntu-20.10/cc.Dockerfile | 12 ++ .../dotnet.Dockerfile | 18 ++- .../docker/test/ubuntu-20.10/java.Dockerfile | 20 ++++ tools/docker/ubuntu-16.04.Dockerfile | 103 ------------------ ....10.Dockerfile => ubuntu-20.10.Dockerfile} | 18 ++- 11 files changed, 50 insertions(+), 265 deletions(-) delete mode 100644 tools/docker/test/ubuntu-16.04/cc.Dockerfile delete mode 100644 tools/docker/test/ubuntu-16.04/dotnet.Dockerfile delete mode 100644 tools/docker/test/ubuntu-16.04/java.Dockerfile delete mode 100644 tools/docker/test/ubuntu-19.10/cc.Dockerfile delete mode 100644 tools/docker/test/ubuntu-19.10/java.Dockerfile create mode 100644 tools/docker/test/ubuntu-20.10/cc.Dockerfile rename tools/docker/test/{ubuntu-19.10 => ubuntu-20.10}/dotnet.Dockerfile (58%) create mode 100644 tools/docker/test/ubuntu-20.10/java.Dockerfile delete mode 100644 tools/docker/ubuntu-16.04.Dockerfile rename tools/docker/{ubuntu-19.10.Dockerfile => ubuntu-20.10.Dockerfile} (80%) diff --git a/tools/docker/Makefile b/tools/docker/Makefile index d863439c81..a7a876336d 100644 --- a/tools/docker/Makefile +++ b/tools/docker/Makefile @@ -39,10 +39,9 @@ help: @echo -e "\t\t${BOLD}alpine-edge${RESET} (latest)" @echo -e "\t\t${BOLD}centos-8${RESET} (latest)" @echo -e "\t\t${BOLD}debian-10${RESET} (latest)" - @echo -e "\t\t${BOLD}ubuntu-19.10${RESET} (Ubuntu latest)" + @echo -e "\t\t${BOLD}ubuntu-20.10${RESET} (Ubuntu latest)" @echo -e "\t\t${BOLD}ubuntu-20.04${RESET} (Ubuntu 20.04 LTS)" @echo -e "\t\t${BOLD}ubuntu-18.04${RESET} (Ubuntu 18.04 LTS)" - @echo -e "\t\t${BOLD}ubuntu-16.04${RESET} (Ubuntu 16.04 LTS)" @echo @echo -e "\t${BOLD}${RESET}:" @echo -e "\t\t${BOLD}env${RESET}" @@ -149,7 +148,7 @@ python: docker_python # $@ target name # Currently supported distro -DISTROS = alpine-edge centos-8 debian-10 ubuntu-20.04 ubuntu-19.10 ubuntu-18.04 ubuntu-16.04 +DISTROS = alpine-edge centos-8 debian-10 ubuntu-20.10 ubuntu-20.04 ubuntu-18.04 STAGES = env devel third_party build export/%/or-tools.snk: or-tools.snk | export diff --git a/tools/docker/test/ubuntu-16.04/cc.Dockerfile b/tools/docker/test/ubuntu-16.04/cc.Dockerfile deleted file mode 100644 index 420ecc1da0..0000000000 --- a/tools/docker/test/ubuntu-16.04/cc.Dockerfile +++ /dev/null @@ -1,32 +0,0 @@ -FROM ubuntu:16.04 - -RUN apt update \ -&& apt install -y -q build-essential zlib1g-dev \ -&& apt clean \ -&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* - -# Install gcc 7 -RUN apt update -qq \ -&& apt install -yq software-properties-common \ -&& add-apt-repository -y ppa:ubuntu-toolchain-r/test \ -&& apt update -qq \ -&& apt install -yq g++-7 \ -&& apt clean \ -&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* -# Configure alias -RUN update-alternatives \ - --install /usr/bin/gcc gcc /usr/bin/gcc-7 60 \ - --slave /usr/bin/g++ g++ /usr/bin/g++-7 \ - --slave /usr/bin/gcov gcov /usr/bin/gcov-7 \ - --slave /usr/bin/gcov-tool gcov-tool /usr/bin/gcov-tool-7 \ - --slave /usr/bin/gcc-ar gcc-ar /usr/bin/gcc-ar-7 \ - --slave /usr/bin/gcc-nm gcc-nm /usr/bin/gcc-nm-7 \ - --slave /usr/bin/gcc-ranlib gcc-ranlib /usr/bin/gcc-ranlib-7 - -#ENV TZ=America/Los_Angeles -#RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone - -WORKDIR /root -ADD or-tools_ubuntu-16.04_v*.tar.gz . - -RUN cd or-tools_*_v* && make test_cc diff --git a/tools/docker/test/ubuntu-16.04/dotnet.Dockerfile b/tools/docker/test/ubuntu-16.04/dotnet.Dockerfile deleted file mode 100644 index 2c58339dd8..0000000000 --- a/tools/docker/test/ubuntu-16.04/dotnet.Dockerfile +++ /dev/null @@ -1,45 +0,0 @@ -FROM ubuntu:16.04 - -RUN apt update -qq \ -&& apt install -y -q build-essential zlib1g-dev \ -&& apt clean \ -&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* - -# Install gcc 7 -RUN apt update -qq \ -&& apt install -yq software-properties-common \ -&& add-apt-repository -y ppa:ubuntu-toolchain-r/test \ -&& apt update -qq \ -&& apt install -yq g++-7 \ -&& apt clean \ -&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* -# Configure alias -RUN update-alternatives \ - --install /usr/bin/gcc gcc /usr/bin/gcc-7 60 \ - --slave /usr/bin/g++ g++ /usr/bin/g++-7 \ - --slave /usr/bin/gcov gcov /usr/bin/gcov-7 \ - --slave /usr/bin/gcov-tool gcov-tool /usr/bin/gcov-tool-7 \ - --slave /usr/bin/gcc-ar gcc-ar /usr/bin/gcc-ar-7 \ - --slave /usr/bin/gcc-nm gcc-nm /usr/bin/gcc-nm-7 \ - --slave /usr/bin/gcc-ranlib gcc-ranlib /usr/bin/gcc-ranlib-7 - -# Dotnet install -# see https://docs.microsoft.com/en-us/dotnet/core/install/linux-package-manager-ubuntu-1604 -RUN apt-get update \ -&& apt-get install -y -q wget apt-transport-https \ -&& wget -q https://packages.microsoft.com/config/ubuntu/16.04/packages-microsoft-prod.deb \ -&& dpkg -i packages-microsoft-prod.deb \ -&& apt-get update \ -&& apt-get install -y -q dotnet-sdk-3.1 \ -&& apt-get clean \ -&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* -# Trigger first run experience by running arbitrary cmd -RUN dotnet --info - -#ENV TZ=America/Los_Angeles -#RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone - -WORKDIR /root -ADD or-tools_ubuntu-16.04_v*.tar.gz . - -RUN cd or-tools_*_v* && make test_dotnet diff --git a/tools/docker/test/ubuntu-16.04/java.Dockerfile b/tools/docker/test/ubuntu-16.04/java.Dockerfile deleted file mode 100644 index 5d04298c47..0000000000 --- a/tools/docker/test/ubuntu-16.04/java.Dockerfile +++ /dev/null @@ -1,33 +0,0 @@ -FROM ubuntu:16.04 - -RUN apt update \ -&& apt install -y -q build-essential zlib1g-dev default-jdk maven \ -&& apt clean \ -&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* -ENV JAVA_HOME=/usr/lib/jvm/default-java - -# Install gcc 7 -RUN apt update -qq \ -&& apt install -yq software-properties-common \ -&& add-apt-repository -y ppa:ubuntu-toolchain-r/test \ -&& apt update -qq \ -&& apt install -yq g++-7 \ -&& apt clean \ -&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* -# Configure alias -RUN update-alternatives \ - --install /usr/bin/gcc gcc /usr/bin/gcc-7 60 \ - --slave /usr/bin/g++ g++ /usr/bin/g++-7 \ - --slave /usr/bin/gcov gcov /usr/bin/gcov-7 \ - --slave /usr/bin/gcov-tool gcov-tool /usr/bin/gcov-tool-7 \ - --slave /usr/bin/gcc-ar gcc-ar /usr/bin/gcc-ar-7 \ - --slave /usr/bin/gcc-nm gcc-nm /usr/bin/gcc-nm-7 \ - --slave /usr/bin/gcc-ranlib gcc-ranlib /usr/bin/gcc-ranlib-7 - -#ENV TZ=America/Los_Angeles -#RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone - -WORKDIR /root -ADD or-tools_ubuntu-16.04_v*.tar.gz . - -RUN cd or-tools_*_v* && make test_java diff --git a/tools/docker/test/ubuntu-19.10/cc.Dockerfile b/tools/docker/test/ubuntu-19.10/cc.Dockerfile deleted file mode 100644 index d3cfdb4aba..0000000000 --- a/tools/docker/test/ubuntu-19.10/cc.Dockerfile +++ /dev/null @@ -1,14 +0,0 @@ -FROM ubuntu:19.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/* - -#ENV TZ=America/Los_Angeles -#RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone - -WORKDIR /root -ADD or-tools_ubuntu-19.10_v*.tar.gz . - -RUN cd or-tools_*_v* && make test_cc diff --git a/tools/docker/test/ubuntu-19.10/java.Dockerfile b/tools/docker/test/ubuntu-19.10/java.Dockerfile deleted file mode 100644 index 6506b01000..0000000000 --- a/tools/docker/test/ubuntu-19.10/java.Dockerfile +++ /dev/null @@ -1,15 +0,0 @@ -FROM ubuntu:19.10 - -RUN apt-get update -qq \ -&& apt-get install -y -q build-essential zlib1g-dev default-jdk maven \ -&& apt-get clean \ -&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* -ENV JAVA_HOME=/usr/lib/jvm/default-java - -#ENV TZ=America/Los_Angeles -#RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone - -WORKDIR /root -ADD or-tools_ubuntu-19.10_v*.tar.gz . - -RUN cd or-tools_*_v* && make test_java diff --git a/tools/docker/test/ubuntu-20.10/cc.Dockerfile b/tools/docker/test/ubuntu-20.10/cc.Dockerfile new file mode 100644 index 0000000000..917c045625 --- /dev/null +++ b/tools/docker/test/ubuntu-20.10/cc.Dockerfile @@ -0,0 +1,12 @@ +FROM ubuntu:20.10 + +RUN apt-get update -qq \ +&& DEBIAN_FRONTEND=noninteractive apt-get install -yq \ + build-essential zlib1g-dev \ +&& apt-get clean \ +&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +WORKDIR /root +ADD or-tools_ubuntu-20.10_v*.tar.gz . + +RUN cd or-tools_*_v* && make test_cc diff --git a/tools/docker/test/ubuntu-19.10/dotnet.Dockerfile b/tools/docker/test/ubuntu-20.10/dotnet.Dockerfile similarity index 58% rename from tools/docker/test/ubuntu-19.10/dotnet.Dockerfile rename to tools/docker/test/ubuntu-20.10/dotnet.Dockerfile index 5ccba081cd..e2c7861b50 100644 --- a/tools/docker/test/ubuntu-19.10/dotnet.Dockerfile +++ b/tools/docker/test/ubuntu-20.10/dotnet.Dockerfile @@ -1,27 +1,25 @@ -FROM ubuntu:19.10 +FROM ubuntu:20.10 RUN apt-get update -qq \ -&& apt-get install -yq build-essential zlib1g-dev \ +&& DEBIAN_FRONTEND=noninteractive apt-get install -yq \ + build-essential zlib1g-dev \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* -# Dotnet install -# see https://docs.microsoft.com/en-us/dotnet/core/install/linux-package-manager-ubuntu-1904 +# Dotnet Install +# see https://docs.microsoft.com/en-us/dotnet/core/install/linux-package-manager-ubuntu-2010 RUN apt-get update -qq \ && apt-get install -yq wget apt-transport-https \ -&& wget -q https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb \ +&& wget -q https://packages.microsoft.com/config/ubuntu/20.10/packages-microsoft-prod.deb \ && dpkg -i packages-microsoft-prod.deb \ && apt-get update -qq \ -&& apt-get install -yq dotnet-sdk-3.1 \ +&& DEBIAN_FRONTEND=noninteractive apt-get install -yq dotnet-sdk-3.1 \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* # Trigger first run experience by running arbitrary cmd RUN dotnet --info -#ENV TZ=America/Los_Angeles -#RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone - WORKDIR /root -ADD or-tools_ubuntu-19.10_v*.tar.gz . +ADD or-tools_ubuntu-20.10_v*.tar.gz . RUN cd or-tools_*_v* && make test_dotnet diff --git a/tools/docker/test/ubuntu-20.10/java.Dockerfile b/tools/docker/test/ubuntu-20.10/java.Dockerfile new file mode 100644 index 0000000000..810dbdda06 --- /dev/null +++ b/tools/docker/test/ubuntu-20.10/java.Dockerfile @@ -0,0 +1,20 @@ +FROM ubuntu:20.10 + +RUN apt-get update -qq \ +&& DEBIAN_FRONTEND=noninteractive apt-get install -yq \ + build-essential zlib1g-dev \ +&& apt-get clean \ +&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +# Java/Maven Install +RUN apt-get update -qq \ +&& DEBIAN_FRONTEND=noninteractive apt-get install -yq \ + default-jdk maven \ +&& apt-get clean \ +&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* +ENV JAVA_HOME=/usr/lib/jvm/default-java + +WORKDIR /root +ADD or-tools_ubuntu-20.10_v*.tar.gz . + +RUN cd or-tools_*_v* && make test_java diff --git a/tools/docker/ubuntu-16.04.Dockerfile b/tools/docker/ubuntu-16.04.Dockerfile deleted file mode 100644 index 402883e9cc..0000000000 --- a/tools/docker/ubuntu-16.04.Dockerfile +++ /dev/null @@ -1,103 +0,0 @@ -FROM ubuntu:16.04 AS env - -############# -## SETUP ## -############# -RUN apt update -qq \ -&& apt install -yq \ - git pkg-config wget make cmake autoconf libtool zlib1g-dev gawk g++ curl subversion \ - lsb-release libpcre3-dev \ -&& apt clean \ -&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* - -# Install gcc 7 -RUN apt update -qq \ -&& apt install -yq software-properties-common \ -&& add-apt-repository -y ppa:ubuntu-toolchain-r/test \ -&& apt update -qq \ -&& apt install -yq g++-7 \ -&& apt clean \ -&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* -# Configure alias -RUN update-alternatives \ - --install /usr/bin/gcc gcc /usr/bin/gcc-7 60 \ - --slave /usr/bin/g++ g++ /usr/bin/g++-7 \ - --slave /usr/bin/gcov gcov /usr/bin/gcov-7 \ - --slave /usr/bin/gcov-tool gcov-tool /usr/bin/gcov-tool-7 \ - --slave /usr/bin/gcc-ar gcc-ar /usr/bin/gcc-ar-7 \ - --slave /usr/bin/gcc-nm gcc-nm /usr/bin/gcc-nm-7 \ - --slave /usr/bin/gcc-ranlib gcc-ranlib /usr/bin/gcc-ranlib-7 - -# Install CMake 3.18.1 -RUN wget "https://cmake.org/files/v3.18/cmake-3.18.1-Linux-x86_64.sh" \ -&& chmod a+x cmake-3.18.1-Linux-x86_64.sh \ -&& ./cmake-3.18.1-Linux-x86_64.sh --prefix=/usr/local/ --skip-license \ -&& rm cmake-3.18.1-Linux-x86_64.sh - -# Install SWIG 4.0.2 -RUN curl --location-trusted \ - --remote-name "https://downloads.sourceforge.net/project/swig/swig/swig-4.0.2/swig-4.0.2.tar.gz" \ - -o swig-4.0.2.tar.gz \ -&& tar xvf swig-4.0.2.tar.gz \ -&& rm swig-4.0.2.tar.gz \ -&& cd swig-4.0.2 \ -&& ./configure --prefix=/usr \ -&& make -j 4 \ -&& make install \ -&& cd .. \ -&& rm -rf swig-4.0.2 - -# Install Java (openjdk-8) -RUN apt-get update -qq \ -&& apt-get install -yq default-jdk maven \ -&& apt-get clean \ -&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* -ENV JAVA_HOME=/usr/lib/jvm/default-java - -# Dotnet Install -# see https://docs.microsoft.com/en-us/dotnet/core/install/linux-package-manager-ubuntu-1604 -RUN apt-get update -qq \ -&& apt-get install -yq apt-transport-https \ -&& wget -q https://packages.microsoft.com/config/ubuntu/16.04/packages-microsoft-prod.deb \ -&& dpkg -i packages-microsoft-prod.deb \ -&& apt-get update -qq \ -&& apt-get install -yq dotnet-sdk-3.1 \ -&& apt-get clean \ -&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* -# Trigger first run experience by running arbitrary cmd -RUN dotnet --info - -ENV TZ=America/Los_Angeles -RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone - -################ -## OR-TOOLS ## -################ -FROM env AS devel -# Copy the snk key -COPY or-tools.snk /root/or-tools.snk -ENV DOTNET_SNK=/root/or-tools.snk - -ARG SRC_GIT_BRANCH -ENV SRC_GIT_BRANCH ${SRC_GIT_BRANCH:-master} -ARG SRC_GIT_SHA1 -ENV SRC_GIT_SHA1 ${SRC_GIT_SHA1:-unknown} - -# Download sources -# use SRC_GIT_SHA1 to modify the command -# i.e. avoid docker reusing the cache when new commit is pushed -WORKDIR /root -RUN git clone -b "${SRC_GIT_BRANCH}" --single-branch https://github.com/google/or-tools \ -&& echo "sha1: $(cd or-tools && git rev-parse --verify HEAD)" \ -&& echo "expected sha1: ${SRC_GIT_SHA1}" - -# Build third parties -FROM devel AS third_party -WORKDIR /root/or-tools -RUN make detect && make third_party - -# Build project -FROM third_party AS build -RUN make detect_cc && make cc -RUN make detect_java && make java -RUN make detect_dotnet && make dotnet diff --git a/tools/docker/ubuntu-19.10.Dockerfile b/tools/docker/ubuntu-20.10.Dockerfile similarity index 80% rename from tools/docker/ubuntu-19.10.Dockerfile rename to tools/docker/ubuntu-20.10.Dockerfile index 42c5379944..d1064339f0 100644 --- a/tools/docker/ubuntu-19.10.Dockerfile +++ b/tools/docker/ubuntu-20.10.Dockerfile @@ -1,21 +1,17 @@ -FROM ubuntu:19.10 AS env +# Create a virtual environment with all tools installed +# ref: https://hub.docker.com/_/ubuntu +FROM ubuntu:20.10 AS env ############# ## SETUP ## ############# RUN apt update -qq \ -&& apt install -yq \ - git pkg-config wget make autoconf libtool zlib1g-dev gawk g++ curl subversion \ +&& DEBIAN_FRONTEND=noninteractive apt install -yq \ + git pkg-config wget make cmake autoconf libtool zlib1g-dev gawk g++ curl subversion \ lsb-release \ && apt clean \ && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* -# Install CMake 3.18.1 -RUN wget "https://cmake.org/files/v3.18/cmake-3.18.1-Linux-x86_64.sh" \ -&& chmod a+x cmake-3.18.1-Linux-x86_64.sh \ -&& ./cmake-3.18.1-Linux-x86_64.sh --prefix=/usr/local/ --skip-license \ -&& rm cmake-3.18.1-Linux-x86_64.sh - # Swig Install RUN apt-get update -qq \ && apt-get install -yq swig \ @@ -30,9 +26,11 @@ RUN apt-get update -qq \ ENV JAVA_HOME=/usr/lib/jvm/default-java # Dotnet Install +# see: +# https://docs.microsoft.com/en-us/dotnet/core/install/linux-package-manager-ubuntu-2010 RUN apt-get update -qq \ && apt-get install -yq apt-transport-https \ -&& wget -q https://packages.microsoft.com/config/ubuntu/19.04/packages-microsoft-prod.deb \ +&& wget -q https://packages.microsoft.com/config/ubuntu/20.10/packages-microsoft-prod.deb \ && dpkg -i packages-microsoft-prod.deb \ && apt-get update -qq \ && apt-get install -yq dotnet-sdk-3.1 \