From 5a06104fdc414d4ea508f2d6e6f91179756ce97e Mon Sep 17 00:00:00 2001 From: Hendo Lim Date: Thu, 10 Oct 2019 18:05:39 -0700 Subject: [PATCH 1/3] debian 9 and 10 tested --- py23-image/centos-7/Dockerfile | 11 ++++++++++- py23-image/debian-10/Dockerfile | 2 +- py23-image/debian-9/Dockerfile | 26 +++++++++++++++++++++++++- py23-image/redhat-8/Dockerfile | 11 +++++++++-- 4 files changed, 45 insertions(+), 5 deletions(-) diff --git a/py23-image/centos-7/Dockerfile b/py23-image/centos-7/Dockerfile index a113bab0..b05aa7b7 100644 --- a/py23-image/centos-7/Dockerfile +++ b/py23-image/centos-7/Dockerfile @@ -4,4 +4,13 @@ USER root RUN yum -y update RUN yum -y install python36 python36-requests -RUN python3 -m ensurepip \ No newline at end of file +RUN python3 -m ensurepip +# INFRA-15385: manual installation of python 3.7 as default distro version is 3.6 +RUN wget https://www.python.org/ftp/python/3.7.4/Python-3.7.4.tgz \ + && tar xzf Python-3.7.4.tgz \ + && cd Python-3.7.4 \ + && ./configure --enable-optimizations --prefix=/usr \ + && make altinstall \ + && cd .. \ + && rm Python-3.7.4.tgz \ + && rm -r Python-3.7.4 \ \ No newline at end of file diff --git a/py23-image/debian-10/Dockerfile b/py23-image/debian-10/Dockerfile index c190369f..218caf2c 100644 --- a/py23-image/debian-10/Dockerfile +++ b/py23-image/debian-10/Dockerfile @@ -2,6 +2,6 @@ ARG SPLUNK_PRODUCT=splunk FROM ${SPLUNK_PRODUCT}-debian-10:latest USER root -RUN apt update +RUN apt-get update RUN apt-get install -y --no-install-recommends python3 python3-pip python3-setuptools python3-requests python3-yaml RUN pip3 --no-cache-dir install ansible \ No newline at end of file diff --git a/py23-image/debian-9/Dockerfile b/py23-image/debian-9/Dockerfile index 159d497f..ee03b5b5 100644 --- a/py23-image/debian-9/Dockerfile +++ b/py23-image/debian-9/Dockerfile @@ -3,4 +3,28 @@ FROM ${SPLUNK_PRODUCT}-debian-9:latest USER root RUN apt-get update -RUN apt-get install -y --no-install-recommends python3 python3-pip python3-requests \ No newline at end of file +RUN apt-get install -y gcc make \ + build-essential checkinstall libreadline-gplv2-dev libncursesw5-dev libssl-dev \ + libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev libffi-dev zlib1g-dev +# INFRA-15385: manual installation of python 3.7 as default distro version is 3.5 +RUN wget https://www.python.org/ftp/python/3.7.4/Python-3.7.4.tgz \ + && tar xzf Python-3.7.4.tgz \ + && cd Python-3.7.4 \ + && ./configure --enable-optimizations --prefix=/usr \ + && make altinstall \ + && cd .. \ + && rm Python-3.7.4.tgz \ + && rm -r Python-3.7.4 \ + && curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py \ + && python3.7 get-pip.py \ + && rm -f get-pip.py +#removing all intermediate dependencies. All the stuff below comes up to 200+MB +RUN apt-get remove --purge -y gcc make build-essential checkinstall libreadline-gplv2-dev libncursesw5-dev \ + libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev libffi-dev zlib1g-dev \ + && apt autoremove -y \ + && apt autoclean +#doing this in case there is an older version of python3 installed +RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 1 \ + #lsb_release not available on python 3.6 and above, but is required by most debian-based image for pip(3) + && ln -s /usr/share/pyshared/lsb_release.py /usr/lib/python3.7/site-packages/lsb_release.py +RUN pip3 --no-cache-dir install ansible requests \ No newline at end of file diff --git a/py23-image/redhat-8/Dockerfile b/py23-image/redhat-8/Dockerfile index 6d035fcd..e8d33d15 100644 --- a/py23-image/redhat-8/Dockerfile +++ b/py23-image/redhat-8/Dockerfile @@ -2,6 +2,13 @@ ARG SPLUNK_PRODUCT=splunk FROM ${SPLUNK_PRODUCT}-redhat-8:latest USER root -RUN microdnf -y --nodocs install python3 -RUN alternatives --set python /usr/bin/python2 +# INFRA-15385: manual installation of python 3.7 as default distro version is 3.6 +RUN wget https://www.python.org/ftp/python/3.7.4/Python-3.7.4.tgz \ + && tar xzf Python-3.7.4.tgz \ + && cd Python-3.7.4 \ + && ./configure --enable-optimizations --prefix=/usr \ + && make altinstall \ + && cd .. \ + && rm Python-3.7.4.tgz \ + && rm -r Python-3.7.4 RUN pip3 -q --no-cache-dir install requests ansible \ No newline at end of file From 28f9a73e7e087ea93cf018e6745fb7c891e0fbc1 Mon Sep 17 00:00:00 2001 From: Hendo Lim Date: Fri, 11 Oct 2019 15:30:38 -0700 Subject: [PATCH 2/3] deb9 replace py3 bin. centos7 tested --- py23-image/centos-7/Dockerfile | 17 +++++++++++++---- py23-image/debian-9/Dockerfile | 6 +----- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/py23-image/centos-7/Dockerfile b/py23-image/centos-7/Dockerfile index b05aa7b7..51523bed 100644 --- a/py23-image/centos-7/Dockerfile +++ b/py23-image/centos-7/Dockerfile @@ -3,14 +3,23 @@ FROM ${SPLUNK_PRODUCT}-centos-7:latest USER root RUN yum -y update -RUN yum -y install python36 python36-requests -RUN python3 -m ensurepip +RUN yum -y install gcc openssl-devel bzip2-devel libffi-devel python-pip # INFRA-15385: manual installation of python 3.7 as default distro version is 3.6 RUN wget https://www.python.org/ftp/python/3.7.4/Python-3.7.4.tgz \ && tar xzf Python-3.7.4.tgz \ && cd Python-3.7.4 \ && ./configure --enable-optimizations --prefix=/usr \ - && make altinstall \ + && make install \ && cd .. \ && rm Python-3.7.4.tgz \ - && rm -r Python-3.7.4 \ \ No newline at end of file + && rm -r Python-3.7.4 \ + && curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py \ + && python3.7 get-pip.py \ + && rm -f get-pip.py \ + #pip version is not automatically "fixed", unlike debian-based + && ln -sf /usr/bin/pip2 /usr/bin/pip \ + && ln -sf /usr/bin/pip3.7 /usr/bin/pip3 +RUN yum remove -y --setopt=tsflags=noscripts gcc openssl-devel bzip2-devel libffi-devel \ + && yum -y autoremove \ + && yum clean all +RUN pip3 --no-cache-dir install ansible requests \ No newline at end of file diff --git a/py23-image/debian-9/Dockerfile b/py23-image/debian-9/Dockerfile index ee03b5b5..99b5148e 100644 --- a/py23-image/debian-9/Dockerfile +++ b/py23-image/debian-9/Dockerfile @@ -11,7 +11,7 @@ RUN wget https://www.python.org/ftp/python/3.7.4/Python-3.7.4.tgz \ && tar xzf Python-3.7.4.tgz \ && cd Python-3.7.4 \ && ./configure --enable-optimizations --prefix=/usr \ - && make altinstall \ + && make install \ && cd .. \ && rm Python-3.7.4.tgz \ && rm -r Python-3.7.4 \ @@ -23,8 +23,4 @@ RUN apt-get remove --purge -y gcc make build-essential checkinstall libreadline- libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev libffi-dev zlib1g-dev \ && apt autoremove -y \ && apt autoclean -#doing this in case there is an older version of python3 installed -RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 1 \ - #lsb_release not available on python 3.6 and above, but is required by most debian-based image for pip(3) - && ln -s /usr/share/pyshared/lsb_release.py /usr/lib/python3.7/site-packages/lsb_release.py RUN pip3 --no-cache-dir install ansible requests \ No newline at end of file From ce7b943137772af2ce39e1ea3e18edb3e23125d2 Mon Sep 17 00:00:00 2001 From: Hendo Lim Date: Mon, 14 Oct 2019 13:17:15 -0700 Subject: [PATCH 3/3] added redhat --- py23-image/centos-7/Dockerfile | 2 +- py23-image/redhat-8/Dockerfile | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/py23-image/centos-7/Dockerfile b/py23-image/centos-7/Dockerfile index 51523bed..4e907aff 100644 --- a/py23-image/centos-7/Dockerfile +++ b/py23-image/centos-7/Dockerfile @@ -20,6 +20,6 @@ RUN wget https://www.python.org/ftp/python/3.7.4/Python-3.7.4.tgz \ && ln -sf /usr/bin/pip2 /usr/bin/pip \ && ln -sf /usr/bin/pip3.7 /usr/bin/pip3 RUN yum remove -y --setopt=tsflags=noscripts gcc openssl-devel bzip2-devel libffi-devel \ - && yum -y autoremove \ + && yum autoremove -y \ && yum clean all RUN pip3 --no-cache-dir install ansible requests \ No newline at end of file diff --git a/py23-image/redhat-8/Dockerfile b/py23-image/redhat-8/Dockerfile index e8d33d15..21695cdb 100644 --- a/py23-image/redhat-8/Dockerfile +++ b/py23-image/redhat-8/Dockerfile @@ -2,13 +2,24 @@ ARG SPLUNK_PRODUCT=splunk FROM ${SPLUNK_PRODUCT}-redhat-8:latest USER root +RUN microdnf -y update \ + && microdnf -y install make gcc openssl-devel bzip2-devel libffi-devel # INFRA-15385: manual installation of python 3.7 as default distro version is 3.6 RUN wget https://www.python.org/ftp/python/3.7.4/Python-3.7.4.tgz \ && tar xzf Python-3.7.4.tgz \ && cd Python-3.7.4 \ && ./configure --enable-optimizations --prefix=/usr \ - && make altinstall \ + && make install \ && cd .. \ && rm Python-3.7.4.tgz \ - && rm -r Python-3.7.4 + && rm -r Python-3.7.4 \ + && curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py \ + && python3.7 get-pip.py \ + && rm -f get-pip.py \ + #pip version is not automatically "fixed", unlike debian-based + && ln -sf /usr/bin/pip2 /usr/bin/pip \ + && ln -sf /usr/bin/pip3.7 /usr/bin/pip3 +#microdnf persists metadata which is a problem for removing packages. So have to clean first before removing. +RUN microdnf clean all \ + && microdnf remove -y gcc make openssl-devel bzip2-devel libffi-devel RUN pip3 -q --no-cache-dir install requests ansible \ No newline at end of file