Skip to content

Commit 064ba8d

Browse files
authored
Merge pull request #126 from readthedocs/humitos/move-env-labels-to-bottom
2 parents a4d4eaf + 087cd75 commit 064ba8d

File tree

1 file changed

+35
-28
lines changed

1 file changed

+35
-28
lines changed

Dockerfile

+35-28
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,6 @@ ENV DEBIAN_FRONTEND noninteractive
66
ENV APPDIR /app
77
ENV LANG C.UTF-8
88

9-
# Versions, and expose labels for external usage
10-
ENV RTD_PYTHON_VERSION_27 2.7.16
11-
ENV RTD_PYTHON_VERSION_35 3.5.7
12-
ENV RTD_PYTHON_VERSION_36 3.6.8
13-
ENV RTD_PYTHON_VERSION_37 3.7.3
14-
ENV RTD_PYTHON_VERSION_38 3.8.0
15-
ENV RTD_PYPY_VERSION_35 pypy3.5-7.0.0
16-
17-
# Note: 4.7.12.1 drastically increases memory usage
18-
ENV RTD_CONDA_VERSION 4.6.14
19-
20-
ENV RTD_PIP_VERSION 20.0.1
21-
ENV RTD_SETUPTOOLS_VERSION 45.1.0
22-
ENV RTD_VIRTUALENV_VERSION 16.7.9
23-
LABEL python.version_27=$RTD_PYTHON_VERSION_27
24-
LABEL python.version_35=$RTD_PYTHON_VERSION_35
25-
LABEL python.version_36=$RTD_PYTHON_VERSION_36
26-
LABEL python.version_37=$RTD_PYTHON_VERSION_37
27-
LABEL python.version_38=$RTD_PYTHON_VERSION_38
28-
LABEL pypy.version_35=$RTD_PYPY_VERSION_35
29-
LABEL conda.version=$RTD_CONDA_VERSION
30-
319
# System dependencies
3210
RUN apt-get -y update
3311
RUN apt-get -y install \
@@ -136,6 +114,7 @@ RUN apt-get -y install \
136114
swig
137115

138116
# Install Python tools/libs
117+
ENV RTD_VIRTUALENV_VERSION 16.7.9
139118
RUN apt-get -y install \
140119
python-pip \
141120
&& pip install -U \
@@ -157,12 +136,6 @@ RUN useradd -m --uid 1005 --gid 205 docs
157136
USER docs
158137
WORKDIR /home/docs
159138

160-
# Install Conda
161-
RUN curl -O https://repo.continuum.io/miniconda/Miniconda2-${RTD_CONDA_VERSION}-Linux-x86_64.sh
162-
RUN bash Miniconda2-${RTD_CONDA_VERSION}-Linux-x86_64.sh -b -p /home/docs/.conda/
163-
ENV PATH $PATH:/home/docs/.conda/bin
164-
RUN rm -f Miniconda2-${RTD_CONDA_VERSION}-Linux-x86_64.sh
165-
166139
# Install pyenv
167140
RUN wget https://github.com/pyenv/pyenv/archive/master.zip
168141
RUN unzip master.zip && \
@@ -171,6 +144,14 @@ RUN unzip master.zip && \
171144
ENV PYENV_ROOT /home/docs/.pyenv
172145
ENV PATH /home/docs/.pyenv/shims:$PATH:/home/docs/.pyenv/bin
173146

147+
# Define Python versions to be installed via pyenv
148+
ENV RTD_PYTHON_VERSION_27 2.7.16
149+
ENV RTD_PYTHON_VERSION_35 3.5.7
150+
ENV RTD_PYTHON_VERSION_36 3.6.8
151+
ENV RTD_PYTHON_VERSION_37 3.7.3
152+
ENV RTD_PYTHON_VERSION_38 3.8.0
153+
ENV RTD_PYPY_VERSION_35 pypy3.5-7.0.0
154+
174155
# Install supported Python versions
175156
RUN pyenv install $RTD_PYTHON_VERSION_27 && \
176157
pyenv install $RTD_PYTHON_VERSION_38 && \
@@ -188,12 +169,17 @@ RUN pyenv install $RTD_PYTHON_VERSION_27 && \
188169

189170
WORKDIR /tmp
190171

172+
# Python2 dependencies are hardcoded because Python2 is
173+
# deprecated. Updating them to their latest versions may raise
174+
# incompatibility issues.
191175
RUN pyenv local $RTD_PYTHON_VERSION_27 && \
192176
pyenv exec pip install --no-cache-dir -U pip==20.0.1 && \
193177
pyenv exec pip install --no-cache-dir -U setuptools==44.0.0 && \
194178
pyenv exec pip install --no-cache-dir --only-binary numpy,scipy numpy scipy && \
195179
pyenv exec pip install --no-cache-dir pandas matplotlib virtualenv==16.7.9
196180

181+
ENV RTD_PIP_VERSION 20.0.1
182+
ENV RTD_SETUPTOOLS_VERSION 45.1.0
197183
RUN pyenv local $RTD_PYTHON_VERSION_38 && \
198184
pyenv exec pip install --no-cache-dir -U pip==$RTD_PIP_VERSION && \
199185
pyenv exec pip install --no-cache-dir -U setuptools==$RTD_SETUPTOOLS_VERSION && \
@@ -224,6 +210,27 @@ RUN pyenv local $RTD_PYPY_VERSION_35 && \
224210
pyenv exec pip install --no-cache-dir -U setuptools==$RTD_SETUPTOOLS_VERSION && \
225211
pyenv exec pip install --no-cache-dir virtualenv==$RTD_VIRTUALENV_VERSION
226212

213+
# Install Conda
214+
WORKDIR /home/docs
215+
# Note: 4.7.12.1 drastically increases memory usage
216+
ENV RTD_CONDA_VERSION 4.6.14
217+
RUN curl -O https://repo.continuum.io/miniconda/Miniconda2-${RTD_CONDA_VERSION}-Linux-x86_64.sh
218+
RUN bash Miniconda2-${RTD_CONDA_VERSION}-Linux-x86_64.sh -b -p /home/docs/.conda/
219+
ENV PATH $PATH:/home/docs/.conda/bin
220+
RUN rm -f Miniconda2-${RTD_CONDA_VERSION}-Linux-x86_64.sh
221+
227222
WORKDIR /
228223

224+
# Adding labels for external usage
225+
LABEL python.version_27=$PYTHON_VERSION_27
226+
LABEL python.version_35=$PYTHON_VERSION_35
227+
LABEL python.version_36=$PYTHON_VERSION_36
228+
LABEL python.version_37=$PYTHON_VERSION_37
229+
LABEL python.version_38=$PYTHON_VERSION_38
230+
LABEL python.pip=$_PIP_VERSION
231+
LABEL python.setuptools=$SETUPTOOLS_VERSION
232+
LABEL python.virtualenv=$VIRTUALENV_VERSION
233+
LABEL pypy.version_35=$PYPY_VERSION_35
234+
LABEL conda.version=$CONDA_VERSION
235+
229236
CMD ["/bin/bash"]

0 commit comments

Comments
 (0)