]> us-delaporte.pagekite.me Git - dotfiles.git/blob - Toybox/Dockerfile
Color scheme tweaks
[dotfiles.git] / Toybox / Dockerfile
1 #
2 # This Dockerfile is from:
3 ## https://raw.githubusercontent.com/docker-library/python/aab9eaf66f960332ab6e19c0d81e0b6e6fa90a3b/2.7/buster/Dockerfile
4
5 FROM buildpack-deps:buster
6
7 # ensure local python is preferred over distribution python
8 ENV PATH /usr/local/bin:$PATH
9
10 # http://bugs.python.org/issue19846
11 # > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK.
12 ENV LANG C.UTF-8
13 # https://github.com/docker-library/python/issues/147
14 ENV PYTHONIOENCODING UTF-8
15
16 # extra dependencies (over what buildpack-deps already includes)
17 RUN apt-get update && apt-get install -y --no-install-recommends \
18 tk-dev \
19 && rm -rf /var/lib/apt/lists/*
20
21 ENV GPG_KEY C01E1CAD5EA2C4F0B8E3571504C367C218ADD4FF
22 ENV PYTHON_VERSION 2.7.17
23
24 RUN set -ex \
25 \
26 && wget -O python.tar.xz "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" \
27 && wget -O python.tar.xz.asc "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc" \
28 && export GNUPGHOME="$(mktemp -d)" \
29 && gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPG_KEY" \
30 && gpg --batch --verify python.tar.xz.asc python.tar.xz \
31 && { command -v gpgconf > /dev/null && gpgconf --kill all || :; } \
32 && rm -rf "$GNUPGHOME" python.tar.xz.asc \
33 && mkdir -p /usr/src/python \
34 && tar -xJC /usr/src/python --strip-components=1 -f python.tar.xz \
35 && rm python.tar.xz \
36 \
37 && cd /usr/src/python \
38 && gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \
39 && ./configure \
40 --build="$gnuArch" \
41 --enable-optimizations \
42 --enable-option-checking=fatal \
43 --enable-shared \
44 --enable-unicode=ucs4 \
45 && make -j "$(nproc)" \
46 # setting PROFILE_TASK makes "--enable-optimizations" reasonable: https://bugs.python.org/issue36044 / https://github.com/docker-library/python/issues/160#issuecomment-509426916
47 PROFILE_TASK='-m test.regrtest --pgo \
48 test_array \
49 test_base64 \
50 test_binascii \
51 test_binhex \
52 test_binop \
53 test_bytes \
54 test_c_locale_coercion \
55 test_class \
56 test_cmath \
57 test_codecs \
58 test_compile \
59 test_complex \
60 test_csv \
61 test_decimal \
62 test_dict \
63 test_float \
64 test_fstring \
65 test_hashlib \
66 test_io \
67 test_iter \
68 test_json \
69 test_long \
70 test_math \
71 test_memoryview \
72 test_pickle \
73 test_re \
74 test_set \
75 test_slice \
76 test_struct \
77 test_threading \
78 test_time \
79 test_traceback \
80 test_unicode \
81 ' \
82 && make install \
83 && ldconfig \
84 \
85 && find /usr/local -depth \
86 \( \
87 \( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \
88 -o \
89 \( -type f -a \( -name '*.pyc' -o -name '*.pyo' \) \) \
90 \) -exec rm -rf '{}' + \
91 && rm -rf /usr/src/python \
92 \
93 && python2 --version
94
95 # if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'"
96 ENV PYTHON_PIP_VERSION 20.0.2
97 # https://github.com/pypa/get-pip
98 ENV PYTHON_GET_PIP_URL https://github.com/pypa/get-pip/raw/d59197a3c169cef378a22428a3fa99d33e080a5d/get-pip.py
99 ENV PYTHON_GET_PIP_SHA256 421ac1d44c0cf9730a088e337867d974b91bdce4ea2636099275071878cc189e
100
101 RUN set -ex; \
102 \
103 wget -O get-pip.py "$PYTHON_GET_PIP_URL"; \
104 echo "$PYTHON_GET_PIP_SHA256 *get-pip.py" | sha256sum --check --strict -; \
105 \
106 python get-pip.py \
107 --disable-pip-version-check \
108 --no-cache-dir \
109 "pip==$PYTHON_PIP_VERSION" \
110 ; \
111 pip --version; \
112 \
113 find /usr/local -depth \
114 \( \
115 \( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \
116 -o \
117 \( -type f -a \( -name '*.pyc' -o -name '*.pyo' \) \) \
118 \) -exec rm -rf '{}' +; \
119 rm -f get-pip.py
120
121 # install "virtualenv", since the vast majority of users of this image will want it
122 RUN pip install --no-cache-dir virtualenv
123
124 CMD ["python2"]