Skip to content
This repository was archived by the owner on Mar 28, 2019. It is now read-only.

Commit a173a1a

Browse files
authored
Merge pull request #27 from praekeltfoundation/upstream-2017-12-20
Upstream updates 2017-12-20
2 parents dc22297 + db1017a commit a173a1a

File tree

11 files changed

+218
-44
lines changed

11 files changed

+218
-44
lines changed

.travis.yml

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,45 +10,46 @@ branches:
1010

1111
env:
1212
global:
13+
- IMAGE_NAME=praekeltfoundation/alpine-python
1314
- REGISTRY_USER=praekeltorgdeploy
1415
- secure: "OIjqHeoNs0jHoqk5mAY2qux+qsokxcuwxBDDdbwCyJg0P5EQAu9XakIzThpZZixIJ/3VAATFdHK/xlNzJeanq7LUZr11DJKBD3H7jmYE2hm5+3qjjNh8KW8Z8NluezmwGWz6gkb8sCsgO2+k7sKC+4h4AERBOceF21V+iOUjBeCw1Q9DVDoBEznbIv1MJhe4G8V5Z3PEFaoerJ4Cy1VsEQRpHEzWyIBxgr4mXfGv4H6PLgTTNSs0+afSCJL5Nc5EU67NpLFTPBIS65yD5xDkLA+Tl4cLomJAwZNe8J9+GQWSua9ehqj0kPOuolkxGWZ5M/Z+yk80i9FNy0CdEWoEKrQMOCnnOwK769PWyKyzYCI9FWPky1rRAqFAdGmMspI3i1qm3wMUUERGqB9U0XuywPbrvqTVKqrdWP69Gwx84ZGvxnODN3nW1Yot/M75p9JbwbnBy+4tRDEqdXGbU1hefsCa7nA51CG1v8kybx6BmCRGWPUDTAR1m+ugRWvJjsaGOSILsSjUcQtlZbGSomLz0rJUgQi2qQEPKVbXv9zx8b9lzIYgxpKpLlONDgNBeFiW5RdT7yDvRUpDk0oSUi0YafkVqON6RuyQmmcg/dsXNtPr/712jqGO2BV3YPpiFB8xAZMWnfaBCe9dOSEDdo7f9PFvz0vUjFoeOC0FnVdd4DY="
1516
matrix:
1617
# Tag 2.7 as 2, 3.6 as 3 and latest, and 3.5 as just 3.5...
17-
- VERSION=2.7 VARIANT= VERSION_LATEST= SEMVER_PRECISION=1
18-
- VERSION=2.7 VARIANT=alpine3.6 VERSION_LATEST= SEMVER_PRECISION=1
19-
- VERSION=3.5 VARIANT= VERSION_LATEST= SEMVER_PRECISION=2
20-
- VERSION=3.6 VARIANT= VERSION_LATEST=1 SEMVER_PRECISION=1
21-
- VERSION=3.6 VARIANT=alpine3.6 VERSION_LATEST=1 SEMVER_PRECISION=1
18+
- PYTHON_VERSION=2.7 PYTHON_LATEST= ALPINE_VERSION=3.4 ALPINE_LATEST=1 SEMVER_PRECISION=1
19+
- PYTHON_VERSION=2.7 PYTHON_LATEST= ALPINE_VERSION=3.6 ALPINE_LATEST= SEMVER_PRECISION=1
20+
- PYTHON_VERSION=2.7 PYTHON_LATEST= ALPINE_VERSION=3.7 ALPINE_LATEST= SEMVER_PRECISION=1
21+
- PYTHON_VERSION=3.5 PYTHON_LATEST= ALPINE_VERSION=3.4 ALPINE_LATEST=1 SEMVER_PRECISION=2
22+
- PYTHON_VERSION=3.6 PYTHON_LATEST=1 ALPINE_VERSION=3.4 ALPINE_LATEST=1 SEMVER_PRECISION=1
23+
- PYTHON_VERSION=3.6 PYTHON_LATEST=1 ALPINE_VERSION=3.6 ALPINE_LATEST= SEMVER_PRECISION=1
24+
- PYTHON_VERSION=3.6 PYTHON_LATEST=1 ALPINE_VERSION=3.7 ALPINE_LATEST= SEMVER_PRECISION=1
2225

2326
install:
2427
- git clone https://github.com/docker-library/official-images.git ~/official-images
2528

2629
before_script:
27-
- cd "$VERSION"
28-
- image="$(awk '$1 == "FROM" { print $2; exit }' onbuild/Dockerfile)${VARIANT:+-$VARIANT}"
29-
- version="$(awk '$2 == "PYTHON_VERSION" { print $3; exit }' Dockerfile)"
30+
- cd "$PYTHON_VERSION"
31+
- variant="alpine$ALPINE_VERSION"; tag="$PYTHON_VERSION-$variant"
32+
- image="$IMAGE_NAME:$tag"
33+
- version="$(awk '$2 == "PYTHON_VERSION" { print $3; exit }' "$variant"/Dockerfile)"
3034
- echo "Building image $image with Python version $version"
3135
# Pull the existing image to use as a cache
3236
- docker pull "$image" || true
33-
- '[ -n "$VARIANT" ] || docker pull "${image}-onbuild" || true'
3437

3538
script:
36-
- travis_retry docker build --pull --cache-from "$image" -t "$image" "${VARIANT:-.}"
39+
- travis_retry docker build --pull --cache-from "$image" -t "$image" "$variant"
3740
# Run the "official-images" tests, but first tag our image like the official
3841
# ones to get the same tests
39-
- docker tag "$image" "python:$VERSION" && ~/official-images/test/run.sh "python:$VERSION"
40-
# Build the onbuild variant with the base variant because it's FROM it
41-
- '[ -n "$VARIANT" ] || docker build --cache-from "${image}-onbuild" -t "${image}-onbuild" onbuild'
42+
- docker tag "$image" "python:$PYTHON_VERSION" && ~/official-images/test/run.sh "python:$PYTHON_VERSION"
4243

4344
after_script:
4445
- docker images
4546

4647
before_deploy:
4748
- pip install docker-ci-deploy==0.3.0
4849
- docker login -u "$REGISTRY_USER" -p "$REGISTRY_PASS"
49-
- '[ -n "$VARIANT" ] || extra_tags="${image}-onbuild"'
50+
- tags="$tag"; if [ -n "$ALPINE_LATEST" ]; then tags="$tags $PYTHON_VERSION"; fi
5051
deploy:
5152
provider: script
52-
script: dcd -V "$version" ${VERSION_LATEST:+-L} -S -P "$SEMVER_PRECISION" "$image" $extra_tags
53+
script: dcd -t $tags -V "$version" ${PYTHON_LATEST:+-L} -S -P "$SEMVER_PRECISION" "$image"
5354
on:
5455
branch: master

2.7/Dockerfile renamed to 2.7/alpine3.4/Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ RUN set -ex \
3535
--enable-shared \
3636
--enable-unicode=ucs4 \
3737
&& make -j$(nproc) \
38+
# set thread stack size to 1MB so we don't segfault before we hit sys.getrecursionlimit()
39+
# https://github.com/alpinelinux/aports/commit/2026e1259422d4e0cf92391ca2d3844356c649d0
40+
EXTRA_CFLAGS="-DTHREAD_STACK_SIZE=0x100000" \
3841
&& make install \
3942
\
4043
&& runDeps="$( \

2.7/alpine3.6/Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ RUN set -ex \
3535
--enable-shared \
3636
--enable-unicode=ucs4 \
3737
&& make -j$(nproc) \
38+
# set thread stack size to 1MB so we don't segfault before we hit sys.getrecursionlimit()
39+
# https://github.com/alpinelinux/aports/commit/2026e1259422d4e0cf92391ca2d3844356c649d0
40+
EXTRA_CFLAGS="-DTHREAD_STACK_SIZE=0x100000" \
3841
&& make install \
3942
\
4043
&& runDeps="$( \

2.7/alpine3.7/Dockerfile

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
FROM praekeltfoundation/alpine-buildpack-deps:3.7
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+
10+
ENV GPG_KEY C01E1CAD5EA2C4F0B8E3571504C367C218ADD4FF
11+
ENV PYTHON_VERSION 2.7.14
12+
13+
RUN set -ex \
14+
&& wget -O python.tar.xz "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" \
15+
&& wget -O python.tar.xz.asc "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc" \
16+
&& export GNUPGHOME="$(mktemp -d)" \
17+
&& gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPG_KEY" \
18+
&& gpg --batch --verify python.tar.xz.asc python.tar.xz \
19+
&& rm -rf "$GNUPGHOME" python.tar.xz.asc \
20+
&& mkdir -p /usr/src/python \
21+
&& tar -xJC /usr/src/python --strip-components=1 -f python.tar.xz \
22+
&& rm python.tar.xz \
23+
\
24+
&& apk add --no-cache --virtual .build-deps \
25+
coreutils \
26+
dpkg-dev dpkg \
27+
tcl-dev \
28+
tk \
29+
tk-dev \
30+
\
31+
&& cd /usr/src/python \
32+
&& gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \
33+
&& ./configure \
34+
--build="$gnuArch" \
35+
--enable-shared \
36+
--enable-unicode=ucs4 \
37+
&& make -j$(nproc) \
38+
# set thread stack size to 1MB so we don't segfault before we hit sys.getrecursionlimit()
39+
# https://github.com/alpinelinux/aports/commit/2026e1259422d4e0cf92391ca2d3844356c649d0
40+
EXTRA_CFLAGS="-DTHREAD_STACK_SIZE=0x100000" \
41+
&& make install \
42+
\
43+
&& runDeps="$( \
44+
scanelf --needed --nobanner --recursive /usr/local \
45+
| awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \
46+
| sort -u \
47+
| xargs -r apk info --installed \
48+
| sort -u \
49+
)" \
50+
&& apk add --virtual .python-rundeps $runDeps \
51+
&& apk del .build-deps \
52+
\
53+
&& find /usr/local -depth \
54+
\( \
55+
\( -type d -a -name test -o -name tests \) \
56+
-o \
57+
\( -type f -a -name '*.pyc' -o -name '*.pyo' \) \
58+
\) -exec rm -rf '{}' + \
59+
&& rm -rf /usr/src/python
60+
61+
# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'"
62+
ENV PYTHON_PIP_VERSION 9.0.1
63+
64+
RUN set -ex; \
65+
\
66+
wget -O get-pip.py 'https://bootstrap.pypa.io/get-pip.py'; \
67+
\
68+
python get-pip.py \
69+
--disable-pip-version-check \
70+
--no-cache-dir \
71+
"pip==$PYTHON_PIP_VERSION" \
72+
; \
73+
pip --version; \
74+
\
75+
find /usr/local -depth \
76+
\( \
77+
\( -type d -a -name test -o -name tests \) \
78+
-o \
79+
\( -type f -a -name '*.pyc' -o -name '*.pyo' \) \
80+
\) -exec rm -rf '{}' +; \
81+
rm -f get-pip.py
82+
83+
# HACK: Fix for building numpy
84+
# https://github.com/docker-library/python/issues/112#issuecomment-238383259
85+
RUN ln -s /usr/include/locale.h /usr/include/xlocale.h
86+
87+
CMD ["python2"]

2.7/onbuild/Dockerfile

Lines changed: 0 additions & 9 deletions
This file was deleted.

3.5/Dockerfile renamed to 3.5/alpine3.4/Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ RUN set -ex \
3838
--with-system-libffi \
3939
--without-ensurepip \
4040
&& make -j$(nproc) \
41+
# set thread stack size to 1MB so we don't segfault before we hit sys.getrecursionlimit()
42+
# https://github.com/alpinelinux/aports/commit/2026e1259422d4e0cf92391ca2d3844356c649d0
43+
EXTRA_CFLAGS="-DTHREAD_STACK_SIZE=0x100000" \
4144
&& make install \
4245
\
4346
&& runDeps="$( \

3.5/onbuild/Dockerfile

Lines changed: 0 additions & 9 deletions
This file was deleted.

3.6/Dockerfile renamed to 3.6/alpine3.4/Dockerfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ ENV PATH /usr/local/bin:$PATH
88
ENV LANG C.UTF-8
99

1010
ENV GPG_KEY 0D96DF4D4110E5C43FBFB17F2D347EA6AA65421D
11-
ENV PYTHON_VERSION 3.6.3
11+
ENV PYTHON_VERSION 3.6.4
1212

1313
RUN set -ex \
1414
&& wget -O python.tar.xz "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" \
@@ -38,6 +38,9 @@ RUN set -ex \
3838
--with-system-libffi \
3939
--without-ensurepip \
4040
&& make -j$(nproc) \
41+
# set thread stack size to 1MB so we don't segfault before we hit sys.getrecursionlimit()
42+
# https://github.com/alpinelinux/aports/commit/2026e1259422d4e0cf92391ca2d3844356c649d0
43+
EXTRA_CFLAGS="-DTHREAD_STACK_SIZE=0x100000" \
4144
&& make install \
4245
\
4346
&& runDeps="$( \

3.6/alpine3.6/Dockerfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ ENV PATH /usr/local/bin:$PATH
88
ENV LANG C.UTF-8
99

1010
ENV GPG_KEY 0D96DF4D4110E5C43FBFB17F2D347EA6AA65421D
11-
ENV PYTHON_VERSION 3.6.3
11+
ENV PYTHON_VERSION 3.6.4
1212

1313
RUN set -ex \
1414
&& apk add --no-cache --virtual .fetch-deps \
@@ -39,6 +39,9 @@ RUN set -ex \
3939
--with-system-libffi \
4040
--without-ensurepip \
4141
&& make -j$(nproc) \
42+
# set thread stack size to 1MB so we don't segfault before we hit sys.getrecursionlimit()
43+
# https://github.com/alpinelinux/aports/commit/2026e1259422d4e0cf92391ca2d3844356c649d0
44+
EXTRA_CFLAGS="-DTHREAD_STACK_SIZE=0x100000" \
4245
&& make install \
4346
\
4447
&& runDeps="$( \

3.6/alpine3.7/Dockerfile

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
FROM praekeltfoundation/alpine-buildpack-deps:3.7
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+
10+
ENV GPG_KEY 0D96DF4D4110E5C43FBFB17F2D347EA6AA65421D
11+
ENV PYTHON_VERSION 3.6.4
12+
13+
RUN set -ex \
14+
&& apk add --no-cache --virtual .fetch-deps \
15+
&& wget -O python.tar.xz "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" \
16+
&& wget -O python.tar.xz.asc "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc" \
17+
&& export GNUPGHOME="$(mktemp -d)" \
18+
&& gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPG_KEY" \
19+
&& gpg --batch --verify python.tar.xz.asc python.tar.xz \
20+
&& rm -rf "$GNUPGHOME" python.tar.xz.asc \
21+
&& mkdir -p /usr/src/python \
22+
&& tar -xJC /usr/src/python --strip-components=1 -f python.tar.xz \
23+
&& rm python.tar.xz \
24+
\
25+
&& apk add --no-cache --virtual .build-deps \
26+
coreutils \
27+
dpkg-dev dpkg \
28+
tcl-dev \
29+
tk \
30+
tk-dev \
31+
\
32+
&& cd /usr/src/python \
33+
&& gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \
34+
&& ./configure \
35+
--build="$gnuArch" \
36+
--enable-loadable-sqlite-extensions \
37+
--enable-shared \
38+
--with-system-expat \
39+
--with-system-libffi \
40+
--without-ensurepip \
41+
&& make -j$(nproc) \
42+
# set thread stack size to 1MB so we don't segfault before we hit sys.getrecursionlimit()
43+
# https://github.com/alpinelinux/aports/commit/2026e1259422d4e0cf92391ca2d3844356c649d0
44+
EXTRA_CFLAGS="-DTHREAD_STACK_SIZE=0x100000" \
45+
&& make install \
46+
\
47+
&& runDeps="$( \
48+
scanelf --needed --nobanner --recursive /usr/local \
49+
| awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \
50+
| sort -u \
51+
| xargs -r apk info --installed \
52+
| sort -u \
53+
)" \
54+
&& apk add --virtual .python-rundeps $runDeps \
55+
&& apk del .build-deps \
56+
\
57+
&& find /usr/local -depth \
58+
\( \
59+
\( -type d -a -name test -o -name tests \) \
60+
-o \
61+
\( -type f -a -name '*.pyc' -o -name '*.pyo' \) \
62+
\) -exec rm -rf '{}' + \
63+
&& rm -rf /usr/src/python
64+
65+
# make some useful symlinks that are expected to exist
66+
RUN cd /usr/local/bin \
67+
&& ln -s idle3 idle \
68+
&& ln -s pydoc3 pydoc \
69+
&& ln -s python3 python \
70+
&& ln -s python3-config python-config
71+
72+
# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'"
73+
ENV PYTHON_PIP_VERSION 9.0.1
74+
75+
RUN set -ex; \
76+
\
77+
wget -O get-pip.py 'https://bootstrap.pypa.io/get-pip.py'; \
78+
\
79+
python get-pip.py \
80+
--disable-pip-version-check \
81+
--no-cache-dir \
82+
"pip==$PYTHON_PIP_VERSION" \
83+
; \
84+
pip --version; \
85+
\
86+
find /usr/local -depth \
87+
\( \
88+
\( -type d -a -name test -o -name tests \) \
89+
-o \
90+
\( -type f -a -name '*.pyc' -o -name '*.pyo' \) \
91+
\) -exec rm -rf '{}' +; \
92+
rm -f get-pip.py
93+
94+
# HACK: Fix for building numpy
95+
# https://github.com/docker-library/python/issues/112#issuecomment-238383259
96+
RUN ln -s /usr/include/locale.h /usr/include/xlocale.h
97+
98+
CMD ["python3"]

3.6/onbuild/Dockerfile

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)