Skip to content

Commit f550db0

Browse files
cschrammyosifkit
authored andcommitted
Add alpine3.13
automake 1.16.3 has a fix to work with Python 3.10 and alpine 3.13 is currently the only viable base image that ships it.
1 parent 903be32 commit f550db0

File tree

6 files changed

+779
-1
lines changed

6 files changed

+779
-1
lines changed

3.10-rc/alpine3.13/Dockerfile

Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
#
2+
# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh"
3+
#
4+
# PLEASE DO NOT EDIT IT DIRECTLY.
5+
#
6+
7+
FROM alpine:3.13
8+
9+
# ensure local python is preferred over distribution python
10+
ENV PATH /usr/local/bin:$PATH
11+
12+
# http://bugs.python.org/issue19846
13+
# > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK.
14+
ENV LANG C.UTF-8
15+
16+
# runtime dependencies
17+
RUN set -eux; \
18+
apk add --no-cache \
19+
# install ca-certificates so that HTTPS works consistently
20+
ca-certificates \
21+
# and tzdata for PEP 615 (https://www.python.org/dev/peps/pep-0615/)
22+
tzdata \
23+
;
24+
# other runtime dependencies for Python are installed later
25+
26+
ENV GPG_KEY A035C8C19219BA821ECEA86B64E628F8D684696D
27+
ENV PYTHON_VERSION 3.10.0a4
28+
29+
RUN set -ex \
30+
&& apk add --no-cache --virtual .fetch-deps \
31+
gnupg \
32+
tar \
33+
xz \
34+
\
35+
&& wget -O python.tar.xz "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" \
36+
&& wget -O python.tar.xz.asc "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc" \
37+
&& export GNUPGHOME="$(mktemp -d)" \
38+
&& gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPG_KEY" \
39+
&& gpg --batch --verify python.tar.xz.asc python.tar.xz \
40+
&& { command -v gpgconf > /dev/null && gpgconf --kill all || :; } \
41+
&& rm -rf "$GNUPGHOME" python.tar.xz.asc \
42+
&& mkdir -p /usr/src/python \
43+
&& tar -xJC /usr/src/python --strip-components=1 -f python.tar.xz \
44+
&& rm python.tar.xz \
45+
\
46+
&& apk add --no-cache --virtual .build-deps \
47+
bluez-dev \
48+
bzip2-dev \
49+
coreutils \
50+
dpkg-dev dpkg \
51+
expat-dev \
52+
findutils \
53+
gcc \
54+
gdbm-dev \
55+
libc-dev \
56+
libffi-dev \
57+
libnsl-dev \
58+
libtirpc-dev \
59+
linux-headers \
60+
make \
61+
ncurses-dev \
62+
openssl-dev \
63+
pax-utils \
64+
readline-dev \
65+
sqlite-dev \
66+
tcl-dev \
67+
tk \
68+
tk-dev \
69+
util-linux-dev \
70+
xz-dev \
71+
zlib-dev \
72+
# add build deps before removing fetch deps in case there's overlap
73+
&& apk del --no-network .fetch-deps \
74+
\
75+
&& cd /usr/src/python \
76+
&& gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \
77+
&& ./configure \
78+
--build="$gnuArch" \
79+
--enable-loadable-sqlite-extensions \
80+
--enable-optimizations \
81+
--enable-option-checking=fatal \
82+
--enable-shared \
83+
--with-system-expat \
84+
--with-system-ffi \
85+
--without-ensurepip \
86+
&& make -j "$(nproc)" \
87+
# set thread stack size to 1MB so we don't segfault before we hit sys.getrecursionlimit()
88+
# https://github.com/alpinelinux/aports/commit/2026e1259422d4e0cf92391ca2d3844356c649d0
89+
EXTRA_CFLAGS="-DTHREAD_STACK_SIZE=0x100000" \
90+
LDFLAGS="-Wl,--strip-all" \
91+
&& make install \
92+
&& rm -rf /usr/src/python \
93+
\
94+
&& find /usr/local -depth \
95+
\( \
96+
\( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \
97+
-o \( -type f -a \( -name '*.pyc' -o -name '*.pyo' -o -name '*.a' \) \) \
98+
\) -exec rm -rf '{}' + \
99+
\
100+
&& find /usr/local -type f -executable -not \( -name '*tkinter*' \) -exec scanelf --needed --nobanner --format '%n#p' '{}' ';' \
101+
| tr ',' '\n' \
102+
| sort -u \
103+
| awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
104+
| xargs -rt apk add --no-cache --virtual .python-rundeps \
105+
&& apk del --no-network .build-deps \
106+
\
107+
&& python3 --version
108+
109+
# make some useful symlinks that are expected to exist
110+
RUN cd /usr/local/bin \
111+
&& ln -s idle3 idle \
112+
&& ln -s pydoc3 pydoc \
113+
&& ln -s python3 python \
114+
&& ln -s python3-config python-config
115+
116+
# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'"
117+
ENV PYTHON_PIP_VERSION 20.3.3
118+
# https://github.com/pypa/get-pip
119+
ENV PYTHON_GET_PIP_URL https://github.com/pypa/get-pip/raw/39356a9d34700a468cf847867ac1a3bd72cc5e45/get-pip.py
120+
ENV PYTHON_GET_PIP_SHA256 ec367c5c9b82fa13c04cfabb0a069e84496d5c36714f14d19b5f24d519d3ba25
121+
122+
RUN set -ex; \
123+
\
124+
wget -O get-pip.py "$PYTHON_GET_PIP_URL"; \
125+
echo "$PYTHON_GET_PIP_SHA256 *get-pip.py" | sha256sum -c -; \
126+
\
127+
python get-pip.py \
128+
--disable-pip-version-check \
129+
--no-cache-dir \
130+
"pip==$PYTHON_PIP_VERSION" \
131+
; \
132+
pip --version; \
133+
\
134+
find /usr/local -depth \
135+
\( \
136+
\( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \
137+
-o \
138+
\( -type f -a \( -name '*.pyc' -o -name '*.pyo' \) \) \
139+
\) -exec rm -rf '{}' +; \
140+
rm -f get-pip.py
141+
142+
CMD ["python3"]

3.6/alpine3.13/Dockerfile

Lines changed: 176 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,176 @@
1+
#
2+
# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh"
3+
#
4+
# PLEASE DO NOT EDIT IT DIRECTLY.
5+
#
6+
7+
FROM alpine:3.13
8+
9+
# ensure local python is preferred over distribution python
10+
ENV PATH /usr/local/bin:$PATH
11+
12+
# http://bugs.python.org/issue19846
13+
# > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK.
14+
ENV LANG C.UTF-8
15+
16+
# runtime dependencies
17+
RUN set -eux; \
18+
apk add --no-cache \
19+
# install ca-certificates so that HTTPS works consistently
20+
ca-certificates \
21+
;
22+
# other runtime dependencies for Python are installed later
23+
24+
ENV GPG_KEY 0D96DF4D4110E5C43FBFB17F2D347EA6AA65421D
25+
ENV PYTHON_VERSION 3.6.12
26+
27+
RUN set -ex \
28+
&& apk add --no-cache --virtual .fetch-deps \
29+
gnupg \
30+
tar \
31+
xz \
32+
\
33+
&& wget -O python.tar.xz "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" \
34+
&& wget -O python.tar.xz.asc "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc" \
35+
&& export GNUPGHOME="$(mktemp -d)" \
36+
&& gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPG_KEY" \
37+
&& gpg --batch --verify python.tar.xz.asc python.tar.xz \
38+
&& { command -v gpgconf > /dev/null && gpgconf --kill all || :; } \
39+
&& rm -rf "$GNUPGHOME" python.tar.xz.asc \
40+
&& mkdir -p /usr/src/python \
41+
&& tar -xJC /usr/src/python --strip-components=1 -f python.tar.xz \
42+
&& rm python.tar.xz \
43+
\
44+
&& apk add --no-cache --virtual .build-deps \
45+
bluez-dev \
46+
bzip2-dev \
47+
coreutils \
48+
dpkg-dev dpkg \
49+
expat-dev \
50+
findutils \
51+
gcc \
52+
gdbm-dev \
53+
libc-dev \
54+
libffi-dev \
55+
libnsl-dev \
56+
libtirpc-dev \
57+
linux-headers \
58+
make \
59+
ncurses-dev \
60+
openssl-dev \
61+
pax-utils \
62+
readline-dev \
63+
sqlite-dev \
64+
tcl-dev \
65+
tk \
66+
tk-dev \
67+
xz-dev \
68+
zlib-dev \
69+
# add build deps before removing fetch deps in case there's overlap
70+
&& apk del --no-network .fetch-deps \
71+
\
72+
&& cd /usr/src/python \
73+
&& gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \
74+
&& ./configure \
75+
--build="$gnuArch" \
76+
--enable-loadable-sqlite-extensions \
77+
--enable-optimizations \
78+
--enable-option-checking=fatal \
79+
--enable-shared \
80+
--with-system-expat \
81+
--with-system-ffi \
82+
--without-ensurepip \
83+
&& make -j "$(nproc)" \
84+
# set thread stack size to 1MB so we don't segfault before we hit sys.getrecursionlimit()
85+
# https://github.com/alpinelinux/aports/commit/2026e1259422d4e0cf92391ca2d3844356c649d0
86+
EXTRA_CFLAGS="-DTHREAD_STACK_SIZE=0x100000" \
87+
LDFLAGS="-Wl,--strip-all" \
88+
# setting PROFILE_TASK makes "--enable-optimizations" reasonable: https://bugs.python.org/issue36044 / https://github.com/docker-library/python/issues/160#issuecomment-509426916
89+
PROFILE_TASK='-m test.regrtest --pgo \
90+
test_array \
91+
test_base64 \
92+
test_binascii \
93+
test_binhex \
94+
test_binop \
95+
test_bytes \
96+
test_c_locale_coercion \
97+
test_class \
98+
test_cmath \
99+
test_codecs \
100+
test_compile \
101+
test_complex \
102+
test_csv \
103+
test_decimal \
104+
test_dict \
105+
test_float \
106+
test_fstring \
107+
test_hashlib \
108+
test_io \
109+
test_iter \
110+
test_json \
111+
test_long \
112+
test_math \
113+
test_memoryview \
114+
test_pickle \
115+
test_re \
116+
test_set \
117+
test_slice \
118+
test_struct \
119+
test_threading \
120+
test_time \
121+
test_traceback \
122+
test_unicode \
123+
' \
124+
&& make install \
125+
&& rm -rf /usr/src/python \
126+
\
127+
&& find /usr/local -depth \
128+
\( \
129+
\( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \
130+
-o \( -type f -a \( -name '*.pyc' -o -name '*.pyo' -o -name '*.a' \) \) \
131+
-o \( -type f -a -name 'wininst-*.exe' \) \
132+
\) -exec rm -rf '{}' + \
133+
\
134+
&& find /usr/local -type f -executable -not \( -name '*tkinter*' \) -exec scanelf --needed --nobanner --format '%n#p' '{}' ';' \
135+
| tr ',' '\n' \
136+
| sort -u \
137+
| awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
138+
| xargs -rt apk add --no-cache --virtual .python-rundeps \
139+
&& apk del --no-network .build-deps \
140+
\
141+
&& python3 --version
142+
143+
# make some useful symlinks that are expected to exist
144+
RUN cd /usr/local/bin \
145+
&& ln -s idle3 idle \
146+
&& ln -s pydoc3 pydoc \
147+
&& ln -s python3 python \
148+
&& ln -s python3-config python-config
149+
150+
# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'"
151+
ENV PYTHON_PIP_VERSION 20.3.3
152+
# https://github.com/pypa/get-pip
153+
ENV PYTHON_GET_PIP_URL https://github.com/pypa/get-pip/raw/39356a9d34700a468cf847867ac1a3bd72cc5e45/get-pip.py
154+
ENV PYTHON_GET_PIP_SHA256 ec367c5c9b82fa13c04cfabb0a069e84496d5c36714f14d19b5f24d519d3ba25
155+
156+
RUN set -ex; \
157+
\
158+
wget -O get-pip.py "$PYTHON_GET_PIP_URL"; \
159+
echo "$PYTHON_GET_PIP_SHA256 *get-pip.py" | sha256sum -c -; \
160+
\
161+
python get-pip.py \
162+
--disable-pip-version-check \
163+
--no-cache-dir \
164+
"pip==$PYTHON_PIP_VERSION" \
165+
; \
166+
pip --version; \
167+
\
168+
find /usr/local -depth \
169+
\( \
170+
\( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \
171+
-o \
172+
\( -type f -a \( -name '*.pyc' -o -name '*.pyo' \) \) \
173+
\) -exec rm -rf '{}' +; \
174+
rm -f get-pip.py
175+
176+
CMD ["python3"]

0 commit comments

Comments
 (0)