From f6445add1f3966c6f1e13fb9751a9fc7b4f1f254 Mon Sep 17 00:00:00 2001 From: Lidi Zheng Date: Fri, 6 Sep 2019 13:05:42 -0700 Subject: [PATCH] Move compile CPython 3.6 to a separate include file --- .../tools/dockerfile/compile_python_36.include | 15 +++++++++++++++ .../python_stretch_3.6_x64/Dockerfile.template | 16 +--------------- .../Dockerfile.template | 11 +---------- .../test/python_stretch_3.6_x64/Dockerfile | 17 +++++++++-------- .../test/python_stretch_default_x64/Dockerfile | 15 ++++++++++----- 5 files changed, 36 insertions(+), 38 deletions(-) create mode 100644 templates/tools/dockerfile/compile_python_36.include diff --git a/templates/tools/dockerfile/compile_python_36.include b/templates/tools/dockerfile/compile_python_36.include new file mode 100644 index 00000000000..e8983db334f --- /dev/null +++ b/templates/tools/dockerfile/compile_python_36.include @@ -0,0 +1,15 @@ +#================= +# Compile CPython 3.6.9 from source + +RUN apt-get update && apt-get install -y zlib1g-dev libssl-dev +RUN apt-get update && apt-get install -y jq build-essential libffi-dev + +RUN cd /tmp && ${'\\'} +wget -q https://www.python.org/ftp/python/3.6.9/Python-3.6.9.tgz && ${'\\'} +tar xzvf Python-3.6.9.tgz && ${'\\'} +cd Python-3.6.9 && ${'\\'} +./configure && ${'\\'} +make install + +RUN python3.6 -m ensurepip && ${'\\'} + python3.6 -m pip install coverage \ No newline at end of file diff --git a/templates/tools/dockerfile/test/python_stretch_3.6_x64/Dockerfile.template b/templates/tools/dockerfile/test/python_stretch_3.6_x64/Dockerfile.template index 2c2cb6de08b..c7d5fe36faa 100644 --- a/templates/tools/dockerfile/test/python_stretch_3.6_x64/Dockerfile.template +++ b/templates/tools/dockerfile/test/python_stretch_3.6_x64/Dockerfile.template @@ -15,18 +15,4 @@ # limitations under the License. <%include file="../../python_stretch.include"/> - - RUN apt-get install -y jq zlib1g-dev libssl-dev - - RUN apt-get install -y jq build-essential libffi-dev - - RUN cd /tmp && ${'\\'} - wget -q https://github.com/python/cpython/archive/v3.6.9.tar.gz && ${'\\'} - tar xzvf v3.6.9.tar.gz && ${'\\'} - cd cpython-3.6.9 && ${'\\'} - ./configure && ${'\\'} - make install - - RUN python3.6 -m ensurepip && ${'\\'} - python3.6 -m pip install coverage - + <%include file="../../compile_python_36.include"/> diff --git a/templates/tools/dockerfile/test/python_stretch_default_x64/Dockerfile.template b/templates/tools/dockerfile/test/python_stretch_default_x64/Dockerfile.template index 80347d4b4d0..8f8bea1eb50 100644 --- a/templates/tools/dockerfile/test/python_stretch_default_x64/Dockerfile.template +++ b/templates/tools/dockerfile/test/python_stretch_default_x64/Dockerfile.template @@ -15,17 +15,8 @@ # limitations under the License. <%include file="../../python_stretch.include"/> + <%include file="../../compile_python_36.include"/> - RUN apt-get update && apt-get install -y zlib1g-dev libssl-dev - RUN apt-get update && apt-get install -y jq build-essential libffi-dev - - RUN cd /tmp && ${'\\'} - wget -q https://www.python.org/ftp/python/3.6.9/Python-3.6.9.tgz && ${'\\'} - tar xzvf Python-3.6.9.tgz && ${'\\'} - cd Python-3.6.9 && ${'\\'} - ./configure && ${'\\'} - make install - RUN cd /tmp && ${'\\'} echo "ff7cdaef4846c89c1ec0d7b709bbd54d Python-3.6.9.tgz" > checksum.md5 && ${'\\'} md5sum -c checksum.md5 diff --git a/tools/dockerfile/test/python_stretch_3.6_x64/Dockerfile b/tools/dockerfile/test/python_stretch_3.6_x64/Dockerfile index 7a3a4a6dea5..a7a5f53e549 100644 --- a/tools/dockerfile/test/python_stretch_3.6_x64/Dockerfile +++ b/tools/dockerfile/test/python_stretch_3.6_x64/Dockerfile @@ -64,17 +64,18 @@ RUN echo 'APT::Default-Release "stretch";' | tee -a /etc/apt/apt.conf.d/00local RUN mkdir /var/local/jenkins +#================= +# Compile CPython 3.6.9 from source -RUN apt-get install -y jq zlib1g-dev libssl-dev - -RUN apt-get install -y jq build-essential libffi-dev +RUN apt-get update && apt-get install -y zlib1g-dev libssl-dev +RUN apt-get update && apt-get install -y jq build-essential libffi-dev RUN cd /tmp && \ - wget -q https://github.com/python/cpython/archive/v3.6.9.tar.gz && \ - tar xzvf v3.6.9.tar.gz && \ - cd cpython-3.6.9 && \ - ./configure && \ - make install +wget -q https://www.python.org/ftp/python/3.6.9/Python-3.6.9.tgz && \ +tar xzvf Python-3.6.9.tgz && \ +cd Python-3.6.9 && \ +./configure && \ +make install RUN python3.6 -m ensurepip && \ python3.6 -m pip install coverage diff --git a/tools/dockerfile/test/python_stretch_default_x64/Dockerfile b/tools/dockerfile/test/python_stretch_default_x64/Dockerfile index cf0eebe2ad6..7aba6c87593 100644 --- a/tools/dockerfile/test/python_stretch_default_x64/Dockerfile +++ b/tools/dockerfile/test/python_stretch_default_x64/Dockerfile @@ -64,16 +64,21 @@ RUN echo 'APT::Default-Release "stretch";' | tee -a /etc/apt/apt.conf.d/00local RUN mkdir /var/local/jenkins +#================= +# Compile CPython 3.6.9 from source RUN apt-get update && apt-get install -y zlib1g-dev libssl-dev RUN apt-get update && apt-get install -y jq build-essential libffi-dev RUN cd /tmp && \ - wget -q https://www.python.org/ftp/python/3.6.9/Python-3.6.9.tgz && \ - tar xzvf Python-3.6.9.tgz && \ - cd Python-3.6.9 && \ - ./configure && \ - make install +wget -q https://www.python.org/ftp/python/3.6.9/Python-3.6.9.tgz && \ +tar xzvf Python-3.6.9.tgz && \ +cd Python-3.6.9 && \ +./configure && \ +make install + +RUN python3.6 -m ensurepip && \ + python3.6 -m pip install coverage RUN cd /tmp && \ echo "ff7cdaef4846c89c1ec0d7b709bbd54d Python-3.6.9.tgz" > checksum.md5 && \