Skip to content

Commit e7de616

Browse files
authored
chore(docker): Update Dockerfile to install pip for every Python3 version (GoogleCloudPlatform#8151)
* chore(docker): Making sure pip is available for every Python version * Making minor improvements * Testing all versions for PIP * Adding test for 3.6 * Remove Python 3.6 from the installation
1 parent b103094 commit e7de616

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

.kokoro/docker/Dockerfile

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ RUN set -ex \
117117
&& export GNUPGHOME="$(mktemp -d)" \
118118
&& echo "disable-ipv6" >> "${GNUPGHOME}/dirmngr.conf" \
119119
&& /tmp/fetch_gpg_keys.sh \
120-
&& for PYTHON_VERSION in 2.7.18 3.6.15 3.7.12 3.8.12 3.9.7 3.10.0; do \
120+
&& for PYTHON_VERSION in 2.7.18 3.7.12 3.8.13 3.9.13 3.10.5; do \
121121
wget --no-check-certificate -O python-${PYTHON_VERSION}.tar.xz "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" \
122122
&& wget --no-check-certificate -O python-${PYTHON_VERSION}.tar.xz.asc "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc" \
123123
&& gpg --batch --verify python-${PYTHON_VERSION}.tar.xz.asc python-${PYTHON_VERSION}.tar.xz \
@@ -156,10 +156,19 @@ RUN wget --no-check-certificate -O /tmp/get-pip.py 'https://bootstrap.pypa.io/ge
156156
# https://github.com/docker-library/python/pull/100
157157
&& [ "$(pip list |tac|tac| awk -F '[ ()]+' '$1 == "pip" { print $2; exit }')" = "$PYTHON_PIP_VERSION" ]
158158

159-
# Ensure Pip for python3
160-
RUN python3 /tmp/get-pip.py
159+
# Ensure Pip for all python3 versions
160+
RUN python3.9 /tmp/get-pip.py
161+
RUN python3.8 /tmp/get-pip.py
162+
RUN python3.7 /tmp/get-pip.py
161163
RUN rm /tmp/get-pip.py
162164

165+
# Test Pip
166+
RUN python3 -m pip
167+
RUN python3.7 -m pip
168+
RUN python3.8 -m pip
169+
RUN python3.9 -m pip
170+
RUN python3.10 -m pip
171+
163172
# Install "virtualenv", since the vast majority of users of this image
164173
# will want it.
165174
RUN pip install --no-cache-dir virtualenv
@@ -191,4 +200,4 @@ RUN useradd -d /h -u ${UID} ${USERNAME}
191200
# Allow nopasswd sudo
192201
RUN echo "${USERNAME} ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
193202

194-
CMD ["python3.10"]
203+
CMD ["python3"]

0 commit comments

Comments
 (0)