Skip to content

Moove ENV, LABEL to bottom #126

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Apr 30, 2020
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ before_install:
install:
- pipenv install
script:
- pipenv run pytest
- pipenv run pytest --suppress-no-test-exit-code
- docker build .

branches:
Expand Down
71 changes: 40 additions & 31 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,6 @@ ENV DEBIAN_FRONTEND noninteractive
ENV APPDIR /app
ENV LANG C.UTF-8

# Versions, and expose labels for external usage
ENV PYTHON_VERSION_27 2.7.16
ENV PYTHON_VERSION_35 3.5.7
ENV PYTHON_VERSION_36 3.6.8
ENV PYTHON_VERSION_37 3.7.3
ENV PYTHON_VERSION_38 3.8.0
ENV PYPY_VERSION_35 pypy3.5-7.0.0

# Note: 4.7.12.1 drastically increases memory usage
ENV CONDA_VERSION 4.6.14

# Use _PIP_VERSION (with starting _) because of a bug in Pip
# https://github.com/pypa/pip/issues/4528
ENV _PIP_VERSION 20.0.1

ENV SETUPTOOLS_VERSION 45.1.0
ENV VIRTUALENV_VERSION 16.7.9
LABEL python.version_27=$PYTHON_VERSION_27
LABEL python.version_35=$PYTHON_VERSION_35
LABEL python.version_36=$PYTHON_VERSION_36
LABEL python.version_37=$PYTHON_VERSION_37
LABEL python.version_38=$PYTHON_VERSION_38
LABEL pypy.version_35=$PYPY_VERSION_35
LABEL conda.version=$CONDA_VERSION

# System dependencies
RUN apt-get -y update
RUN apt-get -y install \
Expand Down Expand Up @@ -140,6 +115,7 @@ RUN apt-get -y install \
swig

# Install Python tools/libs
ENV VIRTUALENV_VERSION 16.7.9
RUN apt-get -y install \
python-pip \
&& pip install -U \
Expand All @@ -161,12 +137,6 @@ RUN useradd -m --uid 1005 --gid 205 docs
USER docs
WORKDIR /home/docs

# Install Conda
RUN curl -O https://repo.continuum.io/miniconda/Miniconda2-${CONDA_VERSION}-Linux-x86_64.sh
RUN bash Miniconda2-${CONDA_VERSION}-Linux-x86_64.sh -b -p /home/docs/.conda/
ENV PATH $PATH:/home/docs/.conda/bin
RUN rm -f Miniconda2-${CONDA_VERSION}-Linux-x86_64.sh

# Install pyenv
RUN wget https://github.com/pyenv/pyenv/archive/master.zip
RUN unzip master.zip && \
Expand All @@ -175,6 +145,14 @@ RUN unzip master.zip && \
ENV PYENV_ROOT /home/docs/.pyenv
ENV PATH /home/docs/.pyenv/shims:$PATH:/home/docs/.pyenv/bin

# Define Python versions to be installed via pyenv
ENV PYTHON_VERSION_27 2.7.16
ENV PYTHON_VERSION_35 3.5.7
ENV PYTHON_VERSION_36 3.6.8
ENV PYTHON_VERSION_37 3.7.3
ENV PYTHON_VERSION_38 3.8.0
ENV PYPY_VERSION_35 pypy3.5-7.0.0

# Install supported Python versions
RUN pyenv install $PYTHON_VERSION_27 && \
pyenv install $PYTHON_VERSION_38 && \
Expand All @@ -192,12 +170,20 @@ RUN pyenv install $PYTHON_VERSION_27 && \

WORKDIR /tmp

# Python2 dependencies are hardcoded because Python2 is
# deprecated. Updating them to their latest versions may raise
# incompatibility issues.
RUN pyenv local $PYTHON_VERSION_27 && \
pyenv exec pip install --no-cache-dir -U pip==20.0.1 && \
pyenv exec pip install --no-cache-dir -U setuptools==44.0.0 && \
pyenv exec pip install --no-cache-dir --only-binary numpy,scipy numpy scipy && \
pyenv exec pip install --no-cache-dir pandas matplotlib virtualenv==16.7.9

# Use _PIP_VERSION (with starting _) because of a bug in Pip
# https://github.com/pypa/pip/issues/4528
ENV _PIP_VERSION 20.0.1

ENV SETUPTOOLS_VERSION 45.1.0
RUN pyenv local $PYTHON_VERSION_38 && \
pyenv exec pip install --no-cache-dir -U pip==$_PIP_VERSION && \
pyenv exec pip install --no-cache-dir -U setuptools==$SETUPTOOLS_VERSION && \
Expand Down Expand Up @@ -228,6 +214,29 @@ RUN pyenv local $PYPY_VERSION_35 && \
pyenv exec pip install --no-cache-dir -U setuptools==$SETUPTOOLS_VERSION && \
pyenv exec pip install --no-cache-dir virtualenv==$VIRTUALENV_VERSION


# Install Conda
WORKDIR /home/docs
# Note: 4.7.12.1 drastically increases memory usage
ENV CONDA_VERSION 4.6.14
RUN curl -O https://repo.continuum.io/miniconda/Miniconda2-${CONDA_VERSION}-Linux-x86_64.sh
RUN bash Miniconda2-${CONDA_VERSION}-Linux-x86_64.sh -b -p /home/docs/.conda/
ENV PATH $PATH:/home/docs/.conda/bin
RUN rm -f Miniconda2-${CONDA_VERSION}-Linux-x86_64.sh


WORKDIR /

# Adding labels for external usage
LABEL python.version_27=$PYTHON_VERSION_27
LABEL python.version_35=$PYTHON_VERSION_35
LABEL python.version_36=$PYTHON_VERSION_36
LABEL python.version_37=$PYTHON_VERSION_37
LABEL python.version_38=$PYTHON_VERSION_38
LABEL python.pip=$_PIP_VERSION
LABEL python.setuptools=$SETUPTOOLS_VERSION
LABEL python.virtualenv=$VIRTUALENV_VERSION
LABEL pypy.version_35=$PYPY_VERSION_35
LABEL conda.version=$CONDA_VERSION

CMD ["/bin/bash"]
3 changes: 2 additions & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ name = "pypi"

"dockerfile-parse" = "*"
requests = "*"
pytest = "*"
pytest = "*"
pytest-custom-exit-code = "*"