From 368542b7fd5f1599a29722ea31a0166ce8848c50 Mon Sep 17 00:00:00 2001 From: Fabien Catteau Date: Fri, 7 Jun 2019 16:46:05 +0000 Subject: Switch to Python 3 Make /usr/bin/env python resolve to python3. Install the latest version of pip in the context of python3. See https://gitlab.com/gitlab-org/gitlab-ee/issues/6783 --- Dockerfile | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) (limited to 'Dockerfile') diff --git a/Dockerfile b/Dockerfile index 359fef3..900019b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,12 +15,35 @@ RUN cd /tmp && \ RUN npm install npm-install-peers cheerio -# Don't let Rubygem fail with the numerous projects using PG or MySQL, install realpath -RUN apt-get update && apt-get install -y libpq-dev libmysqlclient-dev realpath && rm -rf /var/lib/apt/lists/* +# Don't let Rubygem fail with the numerous projects using PG or MySQL, +# install realpath, includes for python3, and pip for python3 +RUN apt-get update && \ + apt-get install -y --no-install-recommends \ + libpq-dev libmysqlclient-dev realpath python3-dev python3-pip && \ + rm -rf /var/lib/apt/lists/* # Don't load RVM automatically, it doesn't work with GitLab-CI RUN mv /etc/profile.d/rvm.sh /rvm.sh +# Warning! Environment variable PIP_VERSION causes the upgrade of pip to fail. +ARG VERSION_OF_PIP=19.1.1 +ENV VERSION_OF_PIP $VERSION_OF_PIP + +ARG SETUPTOOLS_VERSION=41.0.1 +ENV SETUPTOOLS_VERSION $SETUPTOOLS_VERSION + +ARG LOCAL_PYPI_INDEX=/pypi +ENV LOCAL_PYPI_INDEX $LOCAL_PYPI_INDEX + +# Install setuptools, and fetch a recent version pip to be installed later on +RUN pip3 install --disable-pip-version-check setuptools==$SETUPTOOLS_VERSION && \ + mkdir $LOCAL_PYPI_INDEX && \ + wget -q -O $LOCAL_PYPI_INDEX/pip-$VERSION_OF_PIP.tar.gz https://files.pythonhosted.org/packages/93/ab/f86b61bef7ab14909bd7ec3cd2178feb0a1c86d451bc9bccd5a1aedcde5f/pip-$VERSION_OF_PIP.tar.gz + +# Version of Python, defaults to Python 2.7 +ARG LM_PYTHON_VERSION +ENV LM_PYTHON_VERSION ${LM_PYTHON_VERSION:-2.7} + COPY test /test COPY run.sh html2json.js / -- cgit v1.2.3