@@ -2,52 +2,88 @@ FROM ubuntu:18.04
22
33MAINTAINER Florian Finke <florian@finke.email>
44
5- ENV PYTHON_VERSIONS 2.7.13 2.7.14 2.7.15 2.7.16 2.7.17 2.7.18 3.0.1 3.1.0 3.1.1 3.1.2 3.1.3 3.1.4 3.1.5 3.2.0 3.2.1 3.2.2 3.2.3 3.2.4 3.2.5 3.2.6 3.3.0 3.3.1 3.3.2 3.3.3 3.3.4 3.3.5 3.3.6 3.3.7 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.4.6 3.4.7 3.4.8 3.4.9 3.4.10 3.5.0 3.5.1 3.5.2 3.5.3 3.5.4 3.5.5 3.5.6 3.5.7 3.5.8 3.5.9 3.5.10 3.6.0 3.6.1 3.6.2 3.6.3 3.6.4 3.6.5 3.6.6 3.6.7 3.6.8 3.6.9 3.6.10 3.6.11 3.6.12 3.7.0 3.7.1 3.7.2 3.7.3 3.7.4 3.7.5 3.7.6 3.7.7 3.7.8 3.7.9 3.8.0 3.8.1 3.8.2 3.8.3 3.8.4 3.8.5 3.8.6 3.9.0
5+ # tools installed below may need these for their installations
6+ ENV LANG=en_US.UTF-8
7+ ENV LC_ALL=C.UTF-8
8+ ENV PYTHONIOENCODING=UTF-8
9+
10+ RUN set -ex \
11+ && export DEBIAN_FRONTEND=noninteractive \
12+ && apt-get update \
13+ # install curl and its recommendations (HTTPs support, etc)
14+ && apt-get install -y curl \
15+ && curl -sL https://deb.nodesource.com/setup_12.x > setup-node.sh \
16+ && bash setup-node.sh \
17+ && rm setup-node.sh \
18+ && apt-get install --no-install-recommends --fix-missing -y \
19+ build-essential \
20+ curl \
21+ git \
22+ libbz2-dev \
23+ libffi-dev \
24+ libfontconfig \
25+ libjpeg-dev \
26+ libreadline-dev \
27+ libsqlite3-dev \
28+ libssl1.0-dev \
29+ libxml2-dev \
30+ libxslt1-dev \
31+ locales \
32+ make \
33+ nodejs \
34+ openssh-client \
35+ python3-dev \
36+ python3-lxml \
37+ python3-pil \
38+ rsync \
39+ ruby-dev \
40+ rubygems \
41+ zlib1g-dev \
42+ && echo -e "Host *\n\t StrictHostKeyChecking no\n\n " > /etc/ssh/ssh_config \
43+ # Install the most up to date pip (This will include setuptools)
44+ && curl -sL https://bootstrap.pypa.io/get-pip.py > get-pip.py \
45+ && python3 get-pip.py \
46+ && rm get-pip.py \
47+ # install global tools
48+ && pip3 install --upgrade tox tox-pyenv awscli awsebcli \
49+ && npm install -g npm@latest yarn \
50+ # clean caches
51+ && apt-get autoremove -y \
52+ && apt-get clean all \
53+ && rm -rf /var/lib/apt/lists/* \
54+ # generate locale
55+ && echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen \
56+ && locale-gen \
57+ && update-locale LANG=en_US.UTF-8
658
7- ENV DEBIAN_FRONTEND=noninteractive
59+ ARG PYENV_UPDATED_AT
60+ RUN if [ -z "$PYENV_UPDATED_AT" ]; then \
61+ echo >&2 'Build with docker build argument --build-arg=PYENV_UPDATED_AT=$(date +%Y-%m-%d)' ; \
62+ exit 1 ; \
63+ fi
64+ ENV PYENV_UPDATED_AT=$PYENV_UPDATED_AT
865
66+ # pyenv ENV VARS
967ENV PYENV_ROOT /pyenv/
1068ENV PATH /pyenv/shims:/pyenv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
1169ENV PYENV_INSTALLER_ROOT /pyenv-installer/
1270ENV PYENV_REQUIRED_PYTHON_BASENAME python_versions.txt
1371ENV PYENV_REQUIRED_PYTHON /pyenv-config/$PYENV_REQUIRED_PYTHON_BASENAME
1472
15- RUN apt-get update -q -y
16- RUN apt-get install --no-install-recommends --fix-missing -y build-essential \
17- python3-dev python3-pip git make locales libssl1.0-dev \
18- libfontconfig libffi-dev libbz2-dev libreadline-dev libsqlite3-dev \
19- libjpeg-dev zlib1g-dev python3-pil libxml2-dev \
20- libxslt1-dev python3-lxml openssh-client \
21- curl rsync ruby-dev rubygems \
22- && apt-get autoremove -y \
23- && apt-get clean all \
24- && rm -rf /var/lib/apt/lists/*
25-
26- RUN echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen \
27- && locale-gen \
28- && update-locale LANG=en_US.UTF-8
29-
30- ENV LANG=en_US.UTF-8
31- ENV LC_ALL=C.UTF-8
32- ENV PYTHONIOENCODING=UTF-8
33-
34- RUN pip3 install --upgrade setuptools
35- RUN pip3 install --upgrade tox tox-pyenv awscli awsebcli
36-
37- RUN mkdir -p ~/.ssh
38- RUN echo "Host *\n\t StrictHostKeyChecking no\n\n " > ~/.ssh/config
39-
40- RUN curl -sL https://deb.nodesource.com/setup_12.x | bash
41- RUN apt-get -y install nodejs
42-
43- RUN npm install -g npm@latest yarn
44-
45- RUN git clone https://github.com/pyenv/pyenv.git $PYENV_ROOT
46-
47- COPY python_versions.txt $PYENV_REQUIRED_PYTHON
48- RUN while read line; do \
49- pyenv install $line || exit 1 ;\
50- done < $PYENV_REQUIRED_PYTHON
73+ # setup Python versions
74+ RUN set -ex \
75+ && git clone https://github.com/pyenv/pyenv.git $PYENV_ROOT \
76+ && export PYTHON3_VERSIONS="$(\
77+ /pyenv/plugins/python-build/bin/python-build --definitions \
78+ | grep '^3' | grep -v -- '-dev$' | xargs)" \
79+ # manually specify the 2.7.x versions since it is not all of them
80+ && export PYTHON_VERSIONS="2.7.13 2.7.14 2.7.15 2.7.16 2.7.17 2.7.18 $PYTHON3_VERSIONS" \
81+ && mkdir /pyenv-config/ \
82+ && echo "$PYTHON_VERSIONS" | tr ' ' '\n ' > $PYENV_REQUIRED_PYTHON \
83+ && for version in $PYTHON_VERSIONS; do \
84+ pyenv install $version || exit 1 ; \
85+ done \
86+ && pyenv global $PYTHON_VERSIONS \
87+ && pyenv local $PYTHON_VERSIONS
5188
52- RUN pyenv global $PYTHON_VERSIONS
53- RUN pyenv local $PYTHON_VERSIONS
89+ ENTRYPOINT ["/bin/sh" , "-c" , "export PYTHON_VERSIONS=\" $(cat $PYENV_REQUIRED_PYTHON)\" && exec \" $@\" " ]
0 commit comments