Skip to content

Commit 779ac26

Browse files
add alpine3.8 for Python 3.6
1 parent 5899357 commit 779ac26

File tree

1 file changed

+132
-0
lines changed

1 file changed

+132
-0
lines changed

3.6/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.6.6
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"]

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