Skip to content

Commit 8b018e4

Browse files
committed
Unite python pip installation in one layer
1 parent 88ba5cc commit 8b018e4

File tree

1 file changed

+22
-24
lines changed

1 file changed

+22
-24
lines changed

Dockerfile

+22-24
Original file line numberDiff line numberDiff line change
@@ -138,30 +138,28 @@ ENV PYENV_ROOT=/home/docs/.pyenv \
138138
PATH=/home/docs/.pyenv/shims:$PATH:/home/docs/.pyenv/bin
139139

140140
# Install supported Python versions
141-
RUN pyenv install $PYTHON_VERSION_27 && \
142-
pyenv install $PYTHON_VERSION_37 && \
143-
pyenv install $PYTHON_VERSION_36 && \
144-
pyenv global \
145-
$PYTHON_VERSION_27 \
146-
$PYTHON_VERSION_37 \
147-
$PYTHON_VERSION_36
148-
149-
WORKDIR /tmp
150-
151-
RUN pyenv local $PYTHON_VERSION_27 && \
152-
pyenv exec pip install --no-cache-dir -U pip && \
153-
pyenv exec pip install --no-cache-dir --only-binary numpy,scipy numpy scipy && \
154-
pyenv exec pip install --no-cache-dir pandas matplotlib virtualenv
155-
156-
RUN pyenv local $PYTHON_VERSION_37 && \
157-
pyenv exec pip install --no-cache-dir -U pip && \
158-
pyenv exec pip install --no-cache-dir --only-binary numpy,scipy numpy scipy && \
159-
pyenv exec pip install --no-cache-dir pandas matplotlib virtualenv
160-
161-
RUN pyenv local $PYTHON_VERSION_36 && \
162-
pyenv exec pip install --no-cache-dir -U pip && \
163-
pyenv exec pip install --no-cache-dir --only-binary numpy,scipy numpy scipy && \
164-
pyenv exec pip install --no-cache-dir pandas matplotlib virtualenv
141+
RUN set -x \
142+
&& pyenv install "${PYTHON_VERSION_27}" \
143+
&& pyenv install "${PYTHON_VERSION_37}" \
144+
&& pyenv install "${PYTHON_VERSION_36}" \
145+
&& pyenv global \
146+
"${PYTHON_VERSION_27}" \
147+
"${PYTHON_VERSION_37}" \
148+
"${PYTHON_VERSION_36}" \
149+
&& true
150+
151+
RUN set -x \
152+
&& cd /tmp \
153+
&& for env in "${PYTHON_VERSION_27}" "${PYTHON_VERSION_37}" "${PYTHON_VERSION_36}"; \
154+
do pyenv local "${env}" \
155+
&& pyenv exec pip install --no-cache-dir -U pip \
156+
&& pyenv exec pip install --no-cache-dir --only-binary numpy,scipy \
157+
matplotlib \
158+
numpy \
159+
pandas \
160+
scipy \
161+
virtualenv \
162+
; done
165163

166164
WORKDIR /
167165

0 commit comments

Comments
 (0)