Repository navigation
Expand file tree
/
Copy pathDockerfile
More file actions
372 lines (338 loc) · 9.02 KB
/
Copy pathDockerfile
File metadata and controls
372 lines (338 loc) · 9.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
FROM debian
LABEL maintainer "Louis Paternault <spalax@gresille.org>"
# Define download URLS
# Python https://www.python.org/downloads/source/
ARG PYTHON27=https://www.python.org/ftp/python/2.7.18/Python-2.7.18.tar.xz
ARG PYTHON37=https://www.python.org/ftp/python/3.7.17/Python-3.7.17.tar.xz
ARG PYTHON38=https://www.python.org/ftp/python/3.8.20/Python-3.8.20.tar.xz
ARG PYTHON39=https://www.python.org/ftp/python/3.9.25/Python-3.9.25.tar.xz
ARG PYTHON310=https://www.python.org/ftp/python/3.10.21/Python-3.10.21.tar.xz
ARG PYTHON311=https://www.python.org/ftp/python/3.11.16/Python-3.11.16.tar.xz
ARG PYTHON312=https://www.python.org/ftp/python/3.12.14/Python-3.12.14.tar.xz
ARG PYTHON313=https://www.python.org/ftp/python/3.13.15/Python-3.13.15.tar.xz
ARG PYTHON314=https://www.python.org/ftp/python/3.14.7/Python-3.14.7.tar.xz
ARG PYTHON315=https://www.python.org/ftp/python/3.15.0/Python-3.15.0rc2.tar.xz
# Pypy https://www.pypy.org/download.html
ARG PYPY27=https://downloads.python.org/pypy/pypy2.7-v8.0.0-linux64.tar.gz
ARG PYPY37=https://downloads.python.org/pypy/pypy3.7-v7.3.9-linux64.tar.bz2
ARG PYPY38=https://downloads.python.org/pypy/pypy3.8-v7.3.11-linux64.tar.bz2
ARG PYPY39=https://downloads.python.org/pypy/pypy3.9-v7.3.16-linux64.tar.bz2
ARG PYPY310=https://downloads.python.org/pypy/pypy3.10-v7.3.19-linux64.tar.bz2
ARG PYPY311=https://downloads.python.org/pypy/pypy3.11-v8.0.0-linux64.tar.gz
ARG PYPY312=https://downloads.python.org/pypy/pypy3.12-v8.0.0-linux64.tar.gz
# Jython https://www.jython.org/download
ARG JYTHON=https://repo1.maven.org/maven2/org/python/jython-installer/2.7.4/jython-installer-2.7.4.jar
# Micropython https://micropython.org/download
ARG MICROPYTHON=https://micropython.org/resources/source/micropython-1.29.0.tar.xz
# Packages installed for every python version
ARG PACKAGES="pip wheel setuptools"
################################################################################
# Install compilation tools
ARG DEBIAN_FRONTEND=noninteractive
RUN \
apt update --yes && apt install --yes \
build-essential \
gdb \
lcov \
libbz2-dev \
libffi-dev \
libgdbm-compat-dev \
libgdbm-dev \
libncurses5-dev \
libnss3-dev \
libreadline6-dev \
libsqlite3-dev \
libssl-dev \
lzma \
pkg-config \
tk-dev \
uuid-dev \
wget \
zlib1g-dev \
&& rm -rf /var/lib/apt/lists/*
################################################################################
# Python
# Python2.7
RUN \
cd ~ \
&& wget $PYTHON27 \
&& tar -xf Python*.tar.xz \
&& cd Python* \
&& ./configure --enable-optimizations --prefix=/usr/local \
&& make \
&& make altinstall \
&& cd .. \
&& rm Python* -fr \
&& ln -s /usr/local/bin/python2.7 /usr/local/bin/python \
&& ln -s /usr/local/bin/python2.7 /usr/local/bin/python2 \
&& python2.7 -m ensurepip \
&& python2.7 -m pip install -U $PACKAGES
# Python3.7
RUN \
cd ~ \
&& wget $PYTHON37 \
&& tar -xf Python*.tar.xz \
&& cd Python* \
&& ./configure --enable-optimizations --prefix=/usr/local \
&& make \
&& make altinstall \
&& cd .. \
&& rm -fr Python* \
&& python3.7 -m ensurepip \
&& python3.7 -m pip install -U $PACKAGES
# Python3.8
RUN \
cd ~ \
&& wget $PYTHON38 \
&& tar -xf Python*.tar.xz \
&& cd Python* \
&& ./configure --enable-optimizations --prefix=/usr/local \
&& make \
&& make altinstall \
&& cd .. \
&& rm -fr Python* \
&& python3.8 -m ensurepip \
&& python3.8 -m pip install -U $PACKAGES
# Python3.9
RUN \
cd ~ \
&& wget $PYTHON39 \
&& tar -xf Python*.tar.xz \
&& cd Python* \
&& ./configure --enable-optimizations --prefix=/usr/local \
&& make \
&& make altinstall \
&& cd .. \
&& rm -fr Python* \
&& python3.9 -m ensurepip \
&& python3.9 -m pip install -U $PACKAGES
# Python3.10
RUN \
cd ~ \
&& wget $PYTHON310 \
&& tar -xf Python*.tar.xz \
&& cd Python* \
&& ./configure --enable-optimizations --prefix=/usr/local \
&& make \
&& make altinstall \
&& cd .. \
&& rm -fr Python* \
&& python3.10 -m ensurepip \
&& python3.10 -m pip install -U $PACKAGES
# Python3.11
RUN \
cd ~ \
&& wget $PYTHON311 \
&& tar -xf Python*.tar.xz \
&& cd Python* \
&& ./configure --enable-optimizations --prefix=/usr/local \
&& make \
&& make altinstall \
&& cd .. \
&& rm -fr Python* \
&& python3.11 -m ensurepip \
&& python3.11 -m pip install -U $PACKAGES
# Python3.12
RUN \
cd ~ \
&& wget $PYTHON312 \
&& tar -xf Python*.tar.xz \
&& cd Python* \
&& ./configure --enable-optimizations --prefix=/usr/local \
&& make \
&& make altinstall \
&& cd .. \
&& rm -fr Python* \
&& python3.12 -m ensurepip \
&& python3.12 -m pip install -U $PACKAGES
# Python3.13
RUN \
cd ~ \
&& wget $PYTHON313 \
&& tar -xf Python*.tar.xz \
&& cd Python* \
&& ./configure --enable-optimizations --prefix=/usr/local \
&& make \
&& make altinstall \
&& cd .. \
&& rm -fr Python* \
&& python3.13 -m ensurepip \
&& python3.13 -m pip install -U $PACKAGES
# Python3.15
RUN \
cd ~ \
&& wget $PYTHON315 \
&& tar -xf Python*.tar.xz \
&& cd Python* \
&& ./configure --enable-optimizations --prefix=/usr/local \
&& make \
&& make altinstall \
&& cd .. \
&& rm -fr Python* \
&& python3.15 -m ensurepip \
&& python3.15 -m pip install -U $PACKAGES
# The "stable" Python version is installed last, so that some of its tools are not replaced by non-stable ones.
# Python3.14
RUN \
cd ~ \
&& wget $PYTHON314 \
&& tar -xf Python*.tar.xz \
&& cd Python* \
&& ./configure --enable-optimizations --prefix=/usr/local \
&& make \
# This is the stable Python version, hence `make install` instead of `make altinstall`. \
&& make install \
&& cd .. \
&& rm -fr Python* \
&& python3.14 -m ensurepip \
&& python3.14 -m pip install -U $PACKAGES
################################################################################
# Pypy
# Pypy2.7
RUN \
cd ~ \
&& wget $PYPY27 \
&& tar -xf pypy*gz \
&& rm pypy*gz \
&& mv pypy* /opt
# Pypy3.7
RUN \
cd ~ \
&& wget $PYPY37 \
&& tar -xf pypy*bz2 \
&& rm pypy*bz2 \
&& mv pypy* /opt
# Pypy3.8
RUN \
cd ~ \
&& wget $PYPY38 \
&& tar -xf pypy*bz2 \
&& rm pypy*bz2 \
&& mv pypy* /opt
# Pypy3.9
RUN \
cd ~ \
&& wget $PYPY39 \
&& tar -xf pypy*bz2 \
&& rm pypy*bz2 \
&& mv pypy* /opt
# Pypy3.10
RUN \
cd ~ \
&& wget $PYPY310 \
&& tar -xf pypy*bz2 \
&& rm pypy*bz2 \
&& mv pypy* /opt
# Pypy3.11
RUN \
cd ~ \
&& wget $PYPY311 \
&& tar -xf pypy*gz \
&& rm pypy*gz \
&& mv pypy* /opt
# Pypy3.11
RUN \
cd ~ \
&& wget $PYPY312 \
&& tar -xf pypy*gz \
&& rm pypy*gz \
&& mv pypy* /opt
# Pypy symlinks
RUN \
for version in 3.7 3.8 3.9 3.10 3.11 3.12; \
do \
ln -s /opt/pypy${version}*/bin/pypy${version} /usr/local/bin; \
pypy${version} -m ensurepip; \
pypy${version} -m pip install -U pip setuptools; \
done; \
ln -s /usr/local/bin/pypy3.12 /usr/local/bin/pypy3
RUN \
ln -s /opt/pypy2.7*/bin/pypy /usr/local/bin \
&& ln -s /opt/pypy2.7*/bin/pypy2 /usr/local/bin \
&& ln -s /opt/pypy2.7*/bin/pypy2.7 /usr/local/bin \
&& pypy -m ensurepip \
&& pypy -m pip install -U pip setuptools
################################################################################
# Jython
RUN \
apt update --yes && apt install --yes default-jre \
&& rm -rf /var/lib/apt/lists/* \
&& cd ~ \
&& wget $JYTHON \
&& java -jar jython-installer*.jar --silent --type standard --directory /opt/jython \
&& rm jython-installer*.jar \
&& ln -s /opt/jython/bin/jython /usr/local/bin/
################################################################################
# Micropython
RUN \
cd ~ \
&& wget $MICROPYTHON \
&& tar -xf micropython*.tar.xz \
&& rm micropython*.tar.xz \
&& cd micropython*/ports/unix \
&& make \
&& make install \
&& cd ../../.. \
&& rm -fr micropython*
################################################################################
# More python implementations
RUN python3 -m pip install \
cython \
nuitka
################################################################################
# Install python3 packages
# When PEP 668 strikes, use `pip install --break-system-packages`
# https://peps.python.org/pep-0668/
# This should not be necessary:
# https://pythonspeed.com/articles/externally-managed-environment-pep-668/
RUN python3 -m pip install \
black \
build \
coverage \
pycodestyle \
pylint \
tox
################################################################################
# Print versions
RUN for bin in \
python \
python2 \
python2.7 \
python3 \
python3.7 \
python3.8 \
python3.9 \
python3.10 \
python3.11 \
python3.12 \
python3.13 \
python3.14 \
python3.15 \
jython \
pypy \
pypy2 \
pypy2.7 \
pypy3 \
pypy3.7 \
pypy3.8 \
pypy3.9 \
pypy3.10 \
pypy3.11 \
pypy3.12 \
cython \
nuitka \
micropython \
black \
coverage \
pip \
pip2 \
pip3 \
pycodestyle \
pylint \
tox; \
do \
echo "##########"; \
echo "# $bin --version"; \
$bin --version 2>&1; \
done
ENTRYPOINT /bin/bash