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

Upstream updates 2017-12-20 #27

Merged
merged 4 commits into from
Dec 20, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 16 additions & 15 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,45 +10,46 @@ branches:

env:
global:
- IMAGE_NAME=praekeltfoundation/alpine-python
- REGISTRY_USER=praekeltorgdeploy
- secure: "OIjqHeoNs0jHoqk5mAY2qux+qsokxcuwxBDDdbwCyJg0P5EQAu9XakIzThpZZixIJ/3VAATFdHK/xlNzJeanq7LUZr11DJKBD3H7jmYE2hm5+3qjjNh8KW8Z8NluezmwGWz6gkb8sCsgO2+k7sKC+4h4AERBOceF21V+iOUjBeCw1Q9DVDoBEznbIv1MJhe4G8V5Z3PEFaoerJ4Cy1VsEQRpHEzWyIBxgr4mXfGv4H6PLgTTNSs0+afSCJL5Nc5EU67NpLFTPBIS65yD5xDkLA+Tl4cLomJAwZNe8J9+GQWSua9ehqj0kPOuolkxGWZ5M/Z+yk80i9FNy0CdEWoEKrQMOCnnOwK769PWyKyzYCI9FWPky1rRAqFAdGmMspI3i1qm3wMUUERGqB9U0XuywPbrvqTVKqrdWP69Gwx84ZGvxnODN3nW1Yot/M75p9JbwbnBy+4tRDEqdXGbU1hefsCa7nA51CG1v8kybx6BmCRGWPUDTAR1m+ugRWvJjsaGOSILsSjUcQtlZbGSomLz0rJUgQi2qQEPKVbXv9zx8b9lzIYgxpKpLlONDgNBeFiW5RdT7yDvRUpDk0oSUi0YafkVqON6RuyQmmcg/dsXNtPr/712jqGO2BV3YPpiFB8xAZMWnfaBCe9dOSEDdo7f9PFvz0vUjFoeOC0FnVdd4DY="
matrix:
# Tag 2.7 as 2, 3.6 as 3 and latest, and 3.5 as just 3.5...
- VERSION=2.7 VARIANT= VERSION_LATEST= SEMVER_PRECISION=1
- VERSION=2.7 VARIANT=alpine3.6 VERSION_LATEST= SEMVER_PRECISION=1
- VERSION=3.5 VARIANT= VERSION_LATEST= SEMVER_PRECISION=2
- VERSION=3.6 VARIANT= VERSION_LATEST=1 SEMVER_PRECISION=1
- VERSION=3.6 VARIANT=alpine3.6 VERSION_LATEST=1 SEMVER_PRECISION=1
- PYTHON_VERSION=2.7 PYTHON_LATEST= ALPINE_VERSION=3.4 ALPINE_LATEST=1 SEMVER_PRECISION=1
- PYTHON_VERSION=2.7 PYTHON_LATEST= ALPINE_VERSION=3.6 ALPINE_LATEST= SEMVER_PRECISION=1
- PYTHON_VERSION=2.7 PYTHON_LATEST= ALPINE_VERSION=3.7 ALPINE_LATEST= SEMVER_PRECISION=1
- PYTHON_VERSION=3.5 PYTHON_LATEST= ALPINE_VERSION=3.4 ALPINE_LATEST=1 SEMVER_PRECISION=2
- PYTHON_VERSION=3.6 PYTHON_LATEST=1 ALPINE_VERSION=3.4 ALPINE_LATEST=1 SEMVER_PRECISION=1
- PYTHON_VERSION=3.6 PYTHON_LATEST=1 ALPINE_VERSION=3.6 ALPINE_LATEST= SEMVER_PRECISION=1
- PYTHON_VERSION=3.6 PYTHON_LATEST=1 ALPINE_VERSION=3.7 ALPINE_LATEST= SEMVER_PRECISION=1

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

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

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

after_script:
- docker images

before_deploy:
- pip install docker-ci-deploy==0.3.0
- docker login -u "$REGISTRY_USER" -p "$REGISTRY_PASS"
- '[ -n "$VARIANT" ] || extra_tags="${image}-onbuild"'
- tags="$tag"; if [ -n "$ALPINE_LATEST" ]; then tags="$tags $PYTHON_VERSION"; fi
deploy:
provider: script
script: dcd -V "$version" ${VERSION_LATEST:+-L} -S -P "$SEMVER_PRECISION" "$image" $extra_tags
script: dcd -t $tags -V "$version" ${PYTHON_LATEST:+-L} -S -P "$SEMVER_PRECISION" "$image"
on:
branch: master
3 changes: 3 additions & 0 deletions 2.7/Dockerfile → 2.7/alpine3.4/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ RUN set -ex \
--enable-shared \
--enable-unicode=ucs4 \
&& make -j$(nproc) \
# set thread stack size to 1MB so we don't segfault before we hit sys.getrecursionlimit()
# https://github.com/alpinelinux/aports/commit/2026e1259422d4e0cf92391ca2d3844356c649d0
EXTRA_CFLAGS="-DTHREAD_STACK_SIZE=0x100000" \
&& make install \
\
&& runDeps="$( \
Expand Down
3 changes: 3 additions & 0 deletions 2.7/alpine3.6/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ RUN set -ex \
--enable-shared \
--enable-unicode=ucs4 \
&& make -j$(nproc) \
# set thread stack size to 1MB so we don't segfault before we hit sys.getrecursionlimit()
# https://github.com/alpinelinux/aports/commit/2026e1259422d4e0cf92391ca2d3844356c649d0
EXTRA_CFLAGS="-DTHREAD_STACK_SIZE=0x100000" \
&& make install \
\
&& runDeps="$( \
Expand Down
87 changes: 87 additions & 0 deletions 2.7/alpine3.7/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
FROM praekeltfoundation/alpine-buildpack-deps:3.7

# ensure local python is preferred over distribution python
ENV PATH /usr/local/bin:$PATH

# http://bugs.python.org/issue19846
# > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK.
ENV LANG C.UTF-8

ENV GPG_KEY C01E1CAD5EA2C4F0B8E3571504C367C218ADD4FF
ENV PYTHON_VERSION 2.7.14

RUN set -ex \
&& wget -O python.tar.xz "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" \
&& wget -O python.tar.xz.asc "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc" \
&& export GNUPGHOME="$(mktemp -d)" \
&& gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPG_KEY" \
&& gpg --batch --verify python.tar.xz.asc python.tar.xz \
&& rm -rf "$GNUPGHOME" python.tar.xz.asc \
&& mkdir -p /usr/src/python \
&& tar -xJC /usr/src/python --strip-components=1 -f python.tar.xz \
&& rm python.tar.xz \
\
&& apk add --no-cache --virtual .build-deps \
coreutils \
dpkg-dev dpkg \
tcl-dev \
tk \
tk-dev \
\
&& cd /usr/src/python \
&& gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \
&& ./configure \
--build="$gnuArch" \
--enable-shared \
--enable-unicode=ucs4 \
&& make -j$(nproc) \
# set thread stack size to 1MB so we don't segfault before we hit sys.getrecursionlimit()
# https://github.com/alpinelinux/aports/commit/2026e1259422d4e0cf92391ca2d3844356c649d0
EXTRA_CFLAGS="-DTHREAD_STACK_SIZE=0x100000" \
&& make install \
\
&& runDeps="$( \
scanelf --needed --nobanner --recursive /usr/local \
| awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \
| sort -u \
| xargs -r apk info --installed \
| sort -u \
)" \
&& apk add --virtual .python-rundeps $runDeps \
&& apk del .build-deps \
\
&& find /usr/local -depth \
\( \
\( -type d -a -name test -o -name tests \) \
-o \
\( -type f -a -name '*.pyc' -o -name '*.pyo' \) \
\) -exec rm -rf '{}' + \
&& rm -rf /usr/src/python

# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'"
ENV PYTHON_PIP_VERSION 9.0.1

RUN set -ex; \
\
wget -O get-pip.py 'https://bootstrap.pypa.io/get-pip.py'; \
\
python get-pip.py \
--disable-pip-version-check \
--no-cache-dir \
"pip==$PYTHON_PIP_VERSION" \
; \
pip --version; \
\
find /usr/local -depth \
\( \
\( -type d -a -name test -o -name tests \) \
-o \
\( -type f -a -name '*.pyc' -o -name '*.pyo' \) \
\) -exec rm -rf '{}' +; \
rm -f get-pip.py

# HACK: Fix for building numpy
# https://github.com/docker-library/python/issues/112#issuecomment-238383259
RUN ln -s /usr/include/locale.h /usr/include/xlocale.h

CMD ["python2"]
9 changes: 0 additions & 9 deletions 2.7/onbuild/Dockerfile

This file was deleted.

3 changes: 3 additions & 0 deletions 3.5/Dockerfile → 3.5/alpine3.4/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ RUN set -ex \
--with-system-libffi \
--without-ensurepip \
&& make -j$(nproc) \
# set thread stack size to 1MB so we don't segfault before we hit sys.getrecursionlimit()
# https://github.com/alpinelinux/aports/commit/2026e1259422d4e0cf92391ca2d3844356c649d0
EXTRA_CFLAGS="-DTHREAD_STACK_SIZE=0x100000" \
&& make install \
\
&& runDeps="$( \
Expand Down
9 changes: 0 additions & 9 deletions 3.5/onbuild/Dockerfile

This file was deleted.

5 changes: 4 additions & 1 deletion 3.6/Dockerfile → 3.6/alpine3.4/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ ENV PATH /usr/local/bin:$PATH
ENV LANG C.UTF-8

ENV GPG_KEY 0D96DF4D4110E5C43FBFB17F2D347EA6AA65421D
ENV PYTHON_VERSION 3.6.3
ENV PYTHON_VERSION 3.6.4

RUN set -ex \
&& wget -O python.tar.xz "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" \
Expand Down Expand Up @@ -38,6 +38,9 @@ RUN set -ex \
--with-system-libffi \
--without-ensurepip \
&& make -j$(nproc) \
# set thread stack size to 1MB so we don't segfault before we hit sys.getrecursionlimit()
# https://github.com/alpinelinux/aports/commit/2026e1259422d4e0cf92391ca2d3844356c649d0
EXTRA_CFLAGS="-DTHREAD_STACK_SIZE=0x100000" \
&& make install \
\
&& runDeps="$( \
Expand Down
5 changes: 4 additions & 1 deletion 3.6/alpine3.6/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ ENV PATH /usr/local/bin:$PATH
ENV LANG C.UTF-8

ENV GPG_KEY 0D96DF4D4110E5C43FBFB17F2D347EA6AA65421D
ENV PYTHON_VERSION 3.6.3
ENV PYTHON_VERSION 3.6.4

RUN set -ex \
&& apk add --no-cache --virtual .fetch-deps \
Expand Down Expand Up @@ -39,6 +39,9 @@ RUN set -ex \
--with-system-libffi \
--without-ensurepip \
&& make -j$(nproc) \
# set thread stack size to 1MB so we don't segfault before we hit sys.getrecursionlimit()
# https://github.com/alpinelinux/aports/commit/2026e1259422d4e0cf92391ca2d3844356c649d0
EXTRA_CFLAGS="-DTHREAD_STACK_SIZE=0x100000" \
&& make install \
\
&& runDeps="$( \
Expand Down
98 changes: 98 additions & 0 deletions 3.6/alpine3.7/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
FROM praekeltfoundation/alpine-buildpack-deps:3.7

# ensure local python is preferred over distribution python
ENV PATH /usr/local/bin:$PATH

# http://bugs.python.org/issue19846
# > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK.
ENV LANG C.UTF-8

ENV GPG_KEY 0D96DF4D4110E5C43FBFB17F2D347EA6AA65421D
ENV PYTHON_VERSION 3.6.4

RUN set -ex \
&& apk add --no-cache --virtual .fetch-deps \
&& wget -O python.tar.xz "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" \
&& wget -O python.tar.xz.asc "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc" \
&& export GNUPGHOME="$(mktemp -d)" \
&& gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPG_KEY" \
&& gpg --batch --verify python.tar.xz.asc python.tar.xz \
&& rm -rf "$GNUPGHOME" python.tar.xz.asc \
&& mkdir -p /usr/src/python \
&& tar -xJC /usr/src/python --strip-components=1 -f python.tar.xz \
&& rm python.tar.xz \
\
&& apk add --no-cache --virtual .build-deps \
coreutils \
dpkg-dev dpkg \
tcl-dev \
tk \
tk-dev \
\
&& cd /usr/src/python \
&& gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \
&& ./configure \
--build="$gnuArch" \
--enable-loadable-sqlite-extensions \
--enable-shared \
--with-system-expat \
--with-system-libffi \
--without-ensurepip \
&& make -j$(nproc) \
# set thread stack size to 1MB so we don't segfault before we hit sys.getrecursionlimit()
# https://github.com/alpinelinux/aports/commit/2026e1259422d4e0cf92391ca2d3844356c649d0
EXTRA_CFLAGS="-DTHREAD_STACK_SIZE=0x100000" \
&& make install \
\
&& runDeps="$( \
scanelf --needed --nobanner --recursive /usr/local \
| awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \
| sort -u \
| xargs -r apk info --installed \
| sort -u \
)" \
&& apk add --virtual .python-rundeps $runDeps \
&& apk del .build-deps \
\
&& find /usr/local -depth \
\( \
\( -type d -a -name test -o -name tests \) \
-o \
\( -type f -a -name '*.pyc' -o -name '*.pyo' \) \
\) -exec rm -rf '{}' + \
&& rm -rf /usr/src/python

# make some useful symlinks that are expected to exist
RUN cd /usr/local/bin \
&& ln -s idle3 idle \
&& ln -s pydoc3 pydoc \
&& ln -s python3 python \
&& ln -s python3-config python-config

# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'"
ENV PYTHON_PIP_VERSION 9.0.1

RUN set -ex; \
\
wget -O get-pip.py 'https://bootstrap.pypa.io/get-pip.py'; \
\
python get-pip.py \
--disable-pip-version-check \
--no-cache-dir \
"pip==$PYTHON_PIP_VERSION" \
; \
pip --version; \
\
find /usr/local -depth \
\( \
\( -type d -a -name test -o -name tests \) \
-o \
\( -type f -a -name '*.pyc' -o -name '*.pyo' \) \
\) -exec rm -rf '{}' +; \
rm -f get-pip.py

# HACK: Fix for building numpy
# https://github.com/docker-library/python/issues/112#issuecomment-238383259
RUN ln -s /usr/include/locale.h /usr/include/xlocale.h

CMD ["python3"]
9 changes: 0 additions & 9 deletions 3.6/onbuild/Dockerfile

This file was deleted.