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 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