From 0ed97cb9bfd7736252c81b2458854b05de5be872 Mon Sep 17 00:00:00 2001 From: Chris Poole Date: Thu, 25 Oct 2018 12:20:02 +0100 Subject: [PATCH 1/3] Update and correct python 2.x dockerfile - Failed to build due to not cd'ing into python source directory - Pull out version number - Prevent Docker warnings due to comments within RUN commands - Build with optimizations enabled Signed-off-by: Chris Poole --- Python/2.x/Dockerfile | 40 ++++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/Python/2.x/Dockerfile b/Python/2.x/Dockerfile index fa79000b..0c924a58 100644 --- a/Python/2.x/Dockerfile +++ b/Python/2.x/Dockerfile @@ -30,17 +30,20 @@ # Base image FROM s390x/ubuntu:16.04 +ARG PYTHON_VER=2.7.15 + # The author MAINTAINER LoZ Open Source Ecosystem (https://www.ibm.com/developerworks/community/groups/community/lozopensource) +# Update and install packaged for compiling RUN apt-get update && apt-get install -y \ bzip2 \ curl \ g++ \ gcc \ - libbz2-dev \ + libbz2-dev \ libc6-dev \ - libgdbm-dev \ + libgdbm-dev \ libncurses5-dev \ libreadline6-dev \ libsqlite3-dev \ @@ -49,24 +52,25 @@ RUN apt-get update && apt-get install -y \ patch \ tar \ wget \ - xz-utils \ - zlib1g-dev \ - libdb1-compat \ - libdb-dev \ - tk8.5-dev \ - gdb \ + xz-utils \ + zlib1g-dev \ + libdb1-compat \ + libdb-dev \ + tk8.5-dev \ + gdb + +# Pull python source +RUN wget https://www.python.org/ftp/python/${PYTHON_VER}/Python-${PYTHON_VER}.tar.xz \ + && tar -xvf Python-${PYTHON_VER}.tar.xz -# Download Python from the ftp site - && wget https://www.python.org/ftp/python/2.7.15/Python-2.7.15.tar.xz \ - && tar -xvf Python-2.7.15.tar.xz \ - -# Build Python - && ./configure --prefix=/usr/local --exec-prefix=/usr/local \ +# Build python with optimizations +RUN cd Python-${PYTHON_VER} \ + && ./configure --enable-optimizations --prefix=/usr/local --exec-prefix=/usr/local \ && make \ - && make install \ + && make install # Clean up cache data and remove dependencies that are not required - && apt-get remove -y \ +RUN apt-get remove -y \ bzip2 \ curl \ g++ \ @@ -74,9 +78,9 @@ RUN apt-get update && apt-get install -y \ make \ patch \ wget \ - xz-utils \ + xz-utils \ && apt autoremove -y \ && apt-get clean && rm -rf /var/lib/apt/lists/* \ - && rm -rf /root/Python-2.7.15.tar.xz /root/Python-2.7.15 + && rm -rf /Python-${PYTHON_VER}.tar.xz /Python-${PYTHON_VER} CMD python --version From 75d3de13dd2bce26cbf8369a823a1d3fc56563a2 Mon Sep 17 00:00:00 2001 From: Chris Poole Date: Thu, 25 Oct 2018 12:20:02 +0100 Subject: [PATCH 2/3] Update and correct python 2.x dockerfile - Failed to build due to not cd'ing into python source directory - Pull out version number - Prevent Docker warnings due to comments within RUN commands - Build with optimizations enabled Signed-off-by: Chris Poole --- Python/2.x/Dockerfile | 40 ++++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/Python/2.x/Dockerfile b/Python/2.x/Dockerfile index fa79000b..586872bd 100644 --- a/Python/2.x/Dockerfile +++ b/Python/2.x/Dockerfile @@ -30,17 +30,20 @@ # Base image FROM s390x/ubuntu:16.04 +ARG PYTHON_VER=2.7.15 + # The author MAINTAINER LoZ Open Source Ecosystem (https://www.ibm.com/developerworks/community/groups/community/lozopensource) +# Update and install packages for compiling RUN apt-get update && apt-get install -y \ bzip2 \ curl \ g++ \ gcc \ - libbz2-dev \ + libbz2-dev \ libc6-dev \ - libgdbm-dev \ + libgdbm-dev \ libncurses5-dev \ libreadline6-dev \ libsqlite3-dev \ @@ -49,24 +52,25 @@ RUN apt-get update && apt-get install -y \ patch \ tar \ wget \ - xz-utils \ - zlib1g-dev \ - libdb1-compat \ - libdb-dev \ - tk8.5-dev \ - gdb \ + xz-utils \ + zlib1g-dev \ + libdb1-compat \ + libdb-dev \ + tk8.5-dev \ + gdb + +# Pull python source +RUN wget https://www.python.org/ftp/python/${PYTHON_VER}/Python-${PYTHON_VER}.tar.xz \ + && tar -xvf Python-${PYTHON_VER}.tar.xz -# Download Python from the ftp site - && wget https://www.python.org/ftp/python/2.7.15/Python-2.7.15.tar.xz \ - && tar -xvf Python-2.7.15.tar.xz \ - -# Build Python - && ./configure --prefix=/usr/local --exec-prefix=/usr/local \ +# Build python with optimizations +RUN cd Python-${PYTHON_VER} \ + && ./configure --enable-optimizations --prefix=/usr/local --exec-prefix=/usr/local \ && make \ - && make install \ + && make install # Clean up cache data and remove dependencies that are not required - && apt-get remove -y \ +RUN apt-get remove -y \ bzip2 \ curl \ g++ \ @@ -74,9 +78,9 @@ RUN apt-get update && apt-get install -y \ make \ patch \ wget \ - xz-utils \ + xz-utils \ && apt autoremove -y \ && apt-get clean && rm -rf /var/lib/apt/lists/* \ - && rm -rf /root/Python-2.7.15.tar.xz /root/Python-2.7.15 + && rm -rf /Python-${PYTHON_VER}.tar.xz /Python-${PYTHON_VER} CMD python --version From dee74743a0a7a4a2ae17010fbaa860cbe63c1ab4 Mon Sep 17 00:00:00 2001 From: Chris Poole Date: Thu, 25 Oct 2018 13:43:30 +0100 Subject: [PATCH 3/3] Update python3 dockerfile to pull out version as arg Signed-off-by: Chris Poole --- Python/3.x/Dockerfile | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/Python/3.x/Dockerfile b/Python/3.x/Dockerfile index 9e6a0582..b679b27a 100644 --- a/Python/3.x/Dockerfile +++ b/Python/3.x/Dockerfile @@ -30,15 +30,18 @@ # Base image FROM s390x/ubuntu:16.04 +ARG PYTHON_VER=3.6.5 + # The author MAINTAINER LoZ Open Source Ecosystem (https://www.ibm.com/developerworks/community/groups/community/lozopensource) +# Update and install packages for compiling RUN apt-get update && apt-get install -y \ g++ \ gcc \ - libbz2-dev \ + libbz2-dev \ libc6-dev \ - libgdbm-dev \ + libgdbm-dev \ libncurses5-dev \ libreadline6-dev \ libsqlite3-dev \ @@ -46,27 +49,27 @@ RUN apt-get update && apt-get install -y \ make \ tar \ wget \ - xz-utils \ + xz-utils # Download Python from the ftp site - && wget https://www.python.org/ftp/python/3.6.5/Python-3.6.5.tar.xz \ - && tar -xvf Python-3.6.5.tar.xz \ +RUN wget https://www.python.org/ftp/python/${PYTHON_VER}/Python-${PYTHON_VER}.tar.xz \ + && tar -xvf Python-${PYTHON_VER}.tar.xz # Build Python - && cd Python-3.6.5 \ - && ./configure --prefix=/usr/local --exec-prefix=/usr/local \ +RUN cd Python-${PYTHON_VER} \ + && ./configure --enable-optimizations --prefix=/usr/local --exec-prefix=/usr/local \ && make \ - && make install \ + && make install # Clean up cache data and remove dependencies that are not required - && apt-get remove -y \ +RUN apt-get remove -y \ g++ \ gcc \ make \ wget \ - xz-utils \ + xz-utils \ && apt autoremove -y \ && apt-get clean && rm -rf /var/lib/apt/lists/* \ - && rm -rf /root/Python-3.6.5.tar.xz /root/Python-3.6.5 + && rm -rf /Python-${PYTHON_VER}.tar.xz /Python-${PYTHON_VER} CMD python3 --version