Skip to content

Commit 635ea5d

Browse files
author
Jonathan Stewmon
committed
add python-3.6
1 parent d037ec9 commit 635ea5d

File tree

5 files changed

+202
-0
lines changed

5 files changed

+202
-0
lines changed

.travis.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ language: bash
22
services: docker
33

44
env:
5+
- VERSION=3.6 VARIANT=
6+
- VERSION=3.6 VARIANT=slim
7+
- VERSION=3.6 VARIANT=alpine
58
- VERSION=3.5 VARIANT=
69
- VERSION=3.5 VARIANT=slim
710
- VERSION=3.5 VARIANT=alpine

3.6/Dockerfile

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
FROM buildpack-deps:jessie
2+
3+
# remove several traces of debian python
4+
RUN apt-get purge -y python.*
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 PYTHON_VERSION 3.6.0a2
11+
12+
# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'"
13+
ENV PYTHON_PIP_VERSION 8.1.2
14+
15+
RUN set -ex \
16+
&& curl -fSL "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" -o python.tar.xz \
17+
&& curl -fSL "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc" -o python.tar.xz.asc \
18+
&& export GNUPGHOME="$(mktemp -d)" \
19+
&& curl -fSL https://www.python.org/static/files/pubkeys.txt | gpg --import \
20+
&& gpg --batch --verify python.tar.xz.asc python.tar.xz \
21+
&& rm -r "$GNUPGHOME" python.tar.xz.asc \
22+
&& mkdir -p /usr/src/python \
23+
&& tar -xJC /usr/src/python --strip-components=1 -f python.tar.xz \
24+
&& rm python.tar.xz \
25+
\
26+
&& cd /usr/src/python \
27+
&& ./configure --enable-shared --enable-unicode=ucs4 \
28+
&& make -j$(nproc) \
29+
&& make install \
30+
&& ldconfig \
31+
&& pip3 install --no-cache-dir --upgrade pip==$PYTHON_PIP_VERSION \
32+
&& [ "$(pip list | awk -F '[ ()]+' '$1 == "pip" { print $2; exit }')" = "$PYTHON_PIP_VERSION" ] \
33+
&& find /usr/local -depth \
34+
\( \
35+
\( -type d -a -name test -o -name tests \) \
36+
-o \
37+
\( -type f -a -name '*.pyc' -o -name '*.pyo' \) \
38+
\) -exec rm -rf '{}' + \
39+
&& rm -rf /usr/src/python ~/.cache
40+
41+
# make some useful symlinks that are expected to exist
42+
RUN cd /usr/local/bin \
43+
&& ln -s easy_install-3.6 easy_install \
44+
&& ln -s idle3 idle \
45+
&& ln -s pydoc3 pydoc \
46+
&& ln -s python3 python \
47+
&& ln -s python3-config python-config
48+
49+
CMD ["python3"]

3.6/alpine/Dockerfile

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
FROM alpine:3.4
2+
3+
# http://bugs.python.org/issue19846
4+
# > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK.
5+
ENV LANG C.UTF-8
6+
7+
ENV PYTHON_VERSION 3.6.0a2
8+
9+
# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'"
10+
ENV PYTHON_PIP_VERSION 8.1.2
11+
12+
RUN set -ex \
13+
&& apk add --no-cache --virtual .fetch-deps curl gnupg \
14+
&& curl -fSL "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" -o python.tar.xz \
15+
&& curl -fSL "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc" -o python.tar.xz.asc \
16+
&& export GNUPGHOME="$(mktemp -d)" \
17+
&& curl -fSL https://www.python.org/static/files/pubkeys.txt | gpg --import \
18+
&& gpg --batch --verify python.tar.xz.asc python.tar.xz \
19+
&& rm -r "$GNUPGHOME" python.tar.xz.asc \
20+
&& mkdir -p /usr/src \
21+
&& tar -xJC /usr/src -f python.tar.xz \
22+
&& mv "/usr/src/Python-$PYTHON_VERSION" /usr/src/python \
23+
&& rm python.tar.xz \
24+
&& apk del .fetch-deps \
25+
\
26+
&& apk add --no-cache --virtual .build-deps \
27+
bzip2-dev \
28+
gcc \
29+
libc-dev \
30+
linux-headers \
31+
make \
32+
ncurses-dev \
33+
openssl-dev \
34+
pax-utils \
35+
readline-dev \
36+
sqlite-dev \
37+
xz-dev \
38+
zlib-dev \
39+
&& cd /usr/src/python \
40+
&& ./configure --enable-shared --enable-unicode=ucs4 \
41+
&& make -j$(getconf _NPROCESSORS_ONLN) \
42+
&& make install \
43+
&& pip3 install --no-cache-dir --upgrade pip==$PYTHON_PIP_VERSION \
44+
&& [ "$(pip list | awk -F '[ ()]+' '$1 == "pip" { print $2; exit }')" = "$PYTHON_PIP_VERSION" ] \
45+
&& find /usr/local -depth \
46+
\( \
47+
\( -type d -a -name test -o -name tests \) \
48+
-o \
49+
\( -type f -a -name '*.pyc' -o -name '*.pyo' \) \
50+
\) -exec rm -rf '{}' + \
51+
&& runDeps="$( \
52+
scanelf --needed --nobanner --recursive /usr/local \
53+
| awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \
54+
| sort -u \
55+
| xargs -r apk info --installed \
56+
| sort -u \
57+
)" \
58+
&& apk add --virtual .python-rundeps $runDeps \
59+
&& apk del .build-deps \
60+
&& rm -rf /usr/src/python ~/.cache
61+
62+
# make some useful symlinks that are expected to exist
63+
RUN cd /usr/local/bin \
64+
&& ln -s easy_install-3.6 easy_install \
65+
&& ln -s idle3 idle \
66+
&& ln -s pydoc3 pydoc \
67+
&& ln -s python3 python \
68+
&& ln -s python3-config python-config
69+
70+
CMD ["python3"]

3.6/onbuild/Dockerfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
FROM python:3.6
2+
3+
RUN mkdir -p /usr/src/app
4+
WORKDIR /usr/src/app
5+
6+
ONBUILD COPY requirements.txt /usr/src/app/
7+
ONBUILD RUN pip install --no-cache-dir -r requirements.txt
8+
9+
ONBUILD COPY . /usr/src/app

3.6/slim/Dockerfile

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
FROM debian:jessie
2+
3+
# remove several traces of debian python
4+
RUN apt-get purge -y python.*
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+
RUN apt-get update && apt-get install -y --no-install-recommends \
11+
ca-certificates \
12+
libsqlite3-0 \
13+
libssl1.0.0 \
14+
&& rm -rf /var/lib/apt/lists/*
15+
16+
ENV PYTHON_VERSION 3.6.0a2
17+
18+
# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'"
19+
ENV PYTHON_PIP_VERSION 8.1.2
20+
21+
RUN set -ex \
22+
&& buildDeps=' \
23+
curl \
24+
gcc \
25+
libbz2-dev \
26+
libc6-dev \
27+
liblzma-dev \
28+
libncurses-dev \
29+
libreadline-dev \
30+
libsqlite3-dev \
31+
libssl-dev \
32+
make \
33+
xz-utils \
34+
zlib1g-dev \
35+
' \
36+
&& apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \
37+
&& curl -fSL "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" -o python.tar.xz \
38+
&& curl -fSL "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc" -o python.tar.xz.asc \
39+
&& export GNUPGHOME="$(mktemp -d)" \
40+
&& curl -fSL https://www.python.org/static/files/pubkeys.txt | gpg --import \
41+
&& gpg --batch --verify python.tar.xz.asc python.tar.xz \
42+
&& rm -r "$GNUPGHOME" python.tar.xz.asc \
43+
&& mkdir -p /usr/src/python \
44+
&& tar -xJC /usr/src/python --strip-components=1 -f python.tar.xz \
45+
&& rm python.tar.xz \
46+
\
47+
&& cd /usr/src/python \
48+
&& ./configure --enable-shared --enable-unicode=ucs4 \
49+
&& make -j$(nproc) \
50+
&& make install \
51+
&& ldconfig \
52+
&& pip3 install --no-cache-dir --upgrade pip==$PYTHON_PIP_VERSION \
53+
&& [ "$(pip list | awk -F '[ ()]+' '$1 == "pip" { print $2; exit }')" = "$PYTHON_PIP_VERSION" ] \
54+
&& find /usr/local -depth \
55+
\( \
56+
\( -type d -a -name test -o -name tests \) \
57+
-o \
58+
\( -type f -a -name '*.pyc' -o -name '*.pyo' \) \
59+
\) -exec rm -rf '{}' + \
60+
&& apt-get purge -y --auto-remove $buildDeps \
61+
&& rm -rf /usr/src/python ~/.cache
62+
63+
# make some useful symlinks that are expected to exist
64+
RUN cd /usr/local/bin \
65+
&& ln -s easy_install-3.6 easy_install \
66+
&& ln -s idle3 idle \
67+
&& ln -s pydoc3 pydoc \
68+
&& ln -s python3 python \
69+
&& ln -s python3-config python-config
70+
71+
CMD ["python3"]

0 commit comments

Comments
 (0)