Skip to content

Commit 375a782

Browse files
tao12345666333tianon
authored andcommitted
Add 3.7/alpine3.8
1 parent 19f8c87 commit 375a782

3 files changed

Lines changed: 136 additions & 3 deletions

File tree

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ services: docker
44
env:
55
- VERSION=3.7 VARIANT=stretch
66
- VERSION=3.7 VARIANT=stretch/slim
7+
- VERSION=3.7 VARIANT=alpine3.8
78
- VERSION=3.7 VARIANT=alpine3.7
89
- VERSION=3.6 VARIANT=stretch
910
- VERSION=3.6 VARIANT=stretch/slim

3.7/alpine3.8/Dockerfile

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
#
2+
# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh"
3+
#
4+
# PLEASE DO NOT EDIT IT DIRECTLY.
5+
#
6+
7+
FROM alpine:3.8
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+
# install ca-certificates so that HTTPS works consistently
17+
# the other runtime dependencies for Python are installed later
18+
RUN apk add --no-cache ca-certificates
19+
20+
ENV GPG_KEY 0D96DF4D4110E5C43FBFB17F2D347EA6AA65421D
21+
ENV PYTHON_VERSION 3.7.0
22+
23+
RUN set -ex \
24+
&& apk add --no-cache --virtual .fetch-deps \
25+
gnupg \
26+
libressl \
27+
tar \
28+
xz \
29+
\
30+
&& wget -O python.tar.xz "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" \
31+
&& wget -O python.tar.xz.asc "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc" \
32+
&& export GNUPGHOME="$(mktemp -d)" \
33+
&& gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPG_KEY" \
34+
&& gpg --batch --verify python.tar.xz.asc python.tar.xz \
35+
&& rm -rf "$GNUPGHOME" python.tar.xz.asc \
36+
&& mkdir -p /usr/src/python \
37+
&& tar -xJC /usr/src/python --strip-components=1 -f python.tar.xz \
38+
&& rm python.tar.xz \
39+
\
40+
&& apk add --no-cache --virtual .build-deps \
41+
bzip2-dev \
42+
coreutils \
43+
dpkg-dev dpkg \
44+
expat-dev \
45+
gcc \
46+
gdbm-dev \
47+
libc-dev \
48+
libffi-dev \
49+
libnsl-dev \
50+
libressl \
51+
libressl-dev \
52+
libtirpc-dev \
53+
linux-headers \
54+
make \
55+
ncurses-dev \
56+
pax-utils \
57+
readline-dev \
58+
sqlite-dev \
59+
tcl-dev \
60+
tk \
61+
tk-dev \
62+
xz-dev \
63+
zlib-dev \
64+
# add build deps before removing fetch deps in case there's overlap
65+
&& apk del .fetch-deps \
66+
\
67+
&& cd /usr/src/python \
68+
&& gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \
69+
&& ./configure \
70+
--build="$gnuArch" \
71+
--enable-loadable-sqlite-extensions \
72+
--enable-shared \
73+
--with-system-expat \
74+
--with-system-ffi \
75+
--without-ensurepip \
76+
&& make -j "$(nproc)" \
77+
# set thread stack size to 1MB so we don't segfault before we hit sys.getrecursionlimit()
78+
# https://github.com/alpinelinux/aports/commit/2026e1259422d4e0cf92391ca2d3844356c649d0
79+
EXTRA_CFLAGS="-DTHREAD_STACK_SIZE=0x100000" \
80+
&& make install \
81+
\
82+
&& runDeps="$( \
83+
scanelf --needed --nobanner --format '%n#p' --recursive /usr/local \
84+
| tr ',' '\n' \
85+
| sort -u \
86+
| awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
87+
)" \
88+
&& apk add --virtual .python-rundeps $runDeps \
89+
&& apk del .build-deps \
90+
\
91+
&& find /usr/local -depth \
92+
\( \
93+
\( -type d -a \( -name test -o -name tests \) \) \
94+
-o \
95+
\( -type f -a \( -name '*.pyc' -o -name '*.pyo' \) \) \
96+
\) -exec rm -rf '{}' + \
97+
&& rm -rf /usr/src/python
98+
99+
# make some useful symlinks that are expected to exist
100+
RUN cd /usr/local/bin \
101+
&& ln -s idle3 idle \
102+
&& ln -s pydoc3 pydoc \
103+
&& ln -s python3 python \
104+
&& ln -s python3-config python-config
105+
106+
# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'"
107+
ENV PYTHON_PIP_VERSION 10.0.1
108+
109+
RUN set -ex; \
110+
\
111+
apk add --no-cache --virtual .fetch-deps libressl; \
112+
\
113+
wget -O get-pip.py 'https://bootstrap.pypa.io/get-pip.py'; \
114+
\
115+
apk del .fetch-deps; \
116+
\
117+
python get-pip.py \
118+
--disable-pip-version-check \
119+
--no-cache-dir \
120+
"pip==$PYTHON_PIP_VERSION" \
121+
; \
122+
pip --version; \
123+
\
124+
find /usr/local -depth \
125+
\( \
126+
\( -type d -a \( -name test -o -name tests \) \) \
127+
-o \
128+
\( -type f -a \( -name '*.pyc' -o -name '*.pyo' \) \) \
129+
\) -exec rm -rf '{}' +; \
130+
rm -f get-pip.py
131+
132+
CMD ["python3"]

update.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ for version in "${versions[@]}"; do
112112
echo "$version: $fullVersion"
113113

114114
for v in \
115-
alpine{3.6,3.7} \
115+
alpine{3.6,3.7,3.8} \
116116
{wheezy,jessie,stretch}{/slim,/onbuild,} \
117117
windows/nanoserver-{1709,sac2016} \
118118
windows/windowsservercore-{1709,ltsc2016} \
@@ -162,8 +162,8 @@ for version in "${versions[@]}"; do
162162
esac
163163

164164
# https://bugs.python.org/issue32598 (Python 3.7.0b1+)
165-
# TL;DR: Python 3.7+ uses OpenSSL functionality which LibreSSL doesn't implement (yet?)
166-
if [[ "$version" == 3.7* ]] && [[ "$variant" == alpine* ]]; then
165+
# TL;DR: Python 3.7+ uses OpenSSL functionality which LibreSSL 2.6.x in Alpine 3.7 doesn't implement
166+
if [[ "$version" == 3.7* ]] && [[ "$variant" == alpine3.7 ]]; then
167167
sed -ri -e 's/libressl/openssl/g' "$dir/Dockerfile"
168168
fi
169169

0 commit comments

Comments
 (0)