Skip to content

Commit c7fd135

Browse files
tao12345666333tianon
authored andcommitted
Add 2.7/alpine3.8
1 parent 375a782 commit c7fd135

File tree

2 files changed

+116
-0
lines changed

2 files changed

+116
-0
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ env:
2828
- VERSION=2.7 VARIANT=jessie
2929
- VERSION=2.7 VARIANT=jessie/slim
3030
- VERSION=2.7 VARIANT=wheezy
31+
- VERSION=2.7 VARIANT=alpine3.8
3132
- VERSION=2.7 VARIANT=alpine3.7
3233
- VERSION=2.7 VARIANT=alpine3.6
3334

2.7/alpine3.8/Dockerfile

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
FROM alpine:3.8
2+
3+
# ensure local python is preferred over distribution python
4+
ENV PATH /usr/local/bin:$PATH
5+
6+
# http://bugs.python.org/issue19846
7+
# > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK.
8+
ENV LANG C.UTF-8
9+
# https://github.com/docker-library/python/issues/147
10+
ENV PYTHONIOENCODING UTF-8
11+
12+
# install ca-certificates so that HTTPS works consistently
13+
# the other runtime dependencies for Python are installed later
14+
RUN apk add --no-cache ca-certificates
15+
16+
ENV GPG_KEY C01E1CAD5EA2C4F0B8E3571504C367C218ADD4FF
17+
ENV PYTHON_VERSION 2.7.15
18+
19+
RUN set -ex \
20+
&& apk add --no-cache --virtual .fetch-deps \
21+
gnupg \
22+
libressl \
23+
tar \
24+
xz \
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 --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPG_KEY" \
30+
&& gpg --batch --verify python.tar.xz.asc python.tar.xz \
31+
&& rm -rf "$GNUPGHOME" python.tar.xz.asc \
32+
&& mkdir -p /usr/src/python \
33+
&& tar -xJC /usr/src/python --strip-components=1 -f python.tar.xz \
34+
&& rm python.tar.xz \
35+
\
36+
&& apk add --no-cache --virtual .build-deps \
37+
bzip2-dev \
38+
coreutils \
39+
dpkg-dev dpkg \
40+
gcc \
41+
gdbm-dev \
42+
libc-dev \
43+
libnsl-dev \
44+
libressl \
45+
libressl-dev \
46+
libtirpc-dev \
47+
linux-headers \
48+
make \
49+
ncurses-dev \
50+
pax-utils \
51+
readline-dev \
52+
sqlite-dev \
53+
tcl-dev \
54+
tk \
55+
tk-dev \
56+
zlib-dev \
57+
# add build deps before removing fetch deps in case there's overlap
58+
&& apk del .fetch-deps \
59+
\
60+
&& cd /usr/src/python \
61+
&& gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \
62+
&& ./configure \
63+
--build="$gnuArch" \
64+
--enable-shared \
65+
--enable-unicode=ucs4 \
66+
&& make -j "$(nproc)" \
67+
# set thread stack size to 1MB so we don't segfault before we hit sys.getrecursionlimit()
68+
# https://github.com/alpinelinux/aports/commit/2026e1259422d4e0cf92391ca2d3844356c649d0
69+
EXTRA_CFLAGS="-DTHREAD_STACK_SIZE=0x100000" \
70+
&& make install \
71+
\
72+
&& runDeps="$( \
73+
scanelf --needed --nobanner --format '%n#p' --recursive /usr/local \
74+
| tr ',' '\n' \
75+
| sort -u \
76+
| awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
77+
)" \
78+
&& apk add --virtual .python-rundeps $runDeps \
79+
&& apk del .build-deps \
80+
\
81+
&& find /usr/local -depth \
82+
\( \
83+
\( -type d -a \( -name test -o -name tests \) \) \
84+
-o \
85+
\( -type f -a \( -name '*.pyc' -o -name '*.pyo' \) \) \
86+
\) -exec rm -rf '{}' + \
87+
&& rm -rf /usr/src/python
88+
89+
# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'"
90+
ENV PYTHON_PIP_VERSION 10.0.1
91+
92+
RUN set -ex; \
93+
\
94+
apk add --no-cache --virtual .fetch-deps libressl; \
95+
\
96+
wget -O get-pip.py 'https://bootstrap.pypa.io/get-pip.py'; \
97+
\
98+
apk del .fetch-deps; \
99+
\
100+
python get-pip.py \
101+
--disable-pip-version-check \
102+
--no-cache-dir \
103+
"pip==$PYTHON_PIP_VERSION" \
104+
; \
105+
pip --version; \
106+
\
107+
find /usr/local -depth \
108+
\( \
109+
\( -type d -a \( -name test -o -name tests \) \) \
110+
-o \
111+
\( -type f -a \( -name '*.pyc' -o -name '*.pyo' \) \) \
112+
\) -exec rm -rf '{}' +; \
113+
rm -f get-pip.py
114+
115+
CMD ["python2"]

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy