Skip to content

Commit b4459ed

Browse files
authored
Merge pull request docker-library#123 from jstewmon/python-3.6
add python-3.6
2 parents d037ec9 + d92b2e0 commit b4459ed

File tree

5 files changed

+211
-0
lines changed

5 files changed

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

3.6/alpine/Dockerfile

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
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+
# gpg: key AA65421D: public key "Ned Deily (Python release signing key) <nad@acm.org>" imported
8+
ENV GPG_KEY 0D96DF4D4110E5C43FBFB17F2D347EA6AA65421D
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+
&& apk add --no-cache --virtual .fetch-deps curl gnupg \
17+
&& curl -fSL "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" -o python.tar.xz \
18+
&& curl -fSL "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc" -o python.tar.xz.asc \
19+
&& export GNUPGHOME="$(mktemp -d)" \
20+
&& gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPG_KEY" \
21+
&& gpg --batch --verify python.tar.xz.asc python.tar.xz \
22+
&& rm -r "$GNUPGHOME" python.tar.xz.asc \
23+
&& mkdir -p /usr/src \
24+
&& tar -xJC /usr/src -f python.tar.xz \
25+
&& mv "/usr/src/Python-$PYTHON_VERSION" /usr/src/python \
26+
&& rm python.tar.xz \
27+
&& apk del .fetch-deps \
28+
\
29+
&& apk add --no-cache --virtual .build-deps \
30+
bzip2-dev \
31+
gcc \
32+
libc-dev \
33+
linux-headers \
34+
make \
35+
ncurses-dev \
36+
openssl-dev \
37+
pax-utils \
38+
readline-dev \
39+
sqlite-dev \
40+
xz-dev \
41+
zlib-dev \
42+
&& cd /usr/src/python \
43+
&& ./configure --enable-shared --enable-unicode=ucs4 \
44+
&& make -j$(getconf _NPROCESSORS_ONLN) \
45+
&& make install \
46+
&& pip3 install --no-cache-dir --upgrade pip==$PYTHON_PIP_VERSION \
47+
&& [ "$(pip list | awk -F '[ ()]+' '$1 == "pip" { print $2; exit }')" = "$PYTHON_PIP_VERSION" ] \
48+
&& find /usr/local -depth \
49+
\( \
50+
\( -type d -a -name test -o -name tests \) \
51+
-o \
52+
\( -type f -a -name '*.pyc' -o -name '*.pyo' \) \
53+
\) -exec rm -rf '{}' + \
54+
&& runDeps="$( \
55+
scanelf --needed --nobanner --recursive /usr/local \
56+
| awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \
57+
| sort -u \
58+
| xargs -r apk info --installed \
59+
| sort -u \
60+
)" \
61+
&& apk add --virtual .python-rundeps $runDeps \
62+
&& apk del .build-deps \
63+
&& rm -rf /usr/src/python ~/.cache
64+
65+
# make some useful symlinks that are expected to exist
66+
RUN cd /usr/local/bin \
67+
&& ln -s easy_install-3.6 easy_install \
68+
&& ln -s idle3 idle \
69+
&& ln -s pydoc3 pydoc \
70+
&& ln -s python3 python \
71+
&& ln -s python3-config python-config
72+
73+
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: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
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+
# gpg: key AA65421D: public key "Ned Deily (Python release signing key) <nad@acm.org>" imported
11+
ENV GPG_KEY 0D96DF4D4110E5C43FBFB17F2D347EA6AA65421D
12+
13+
RUN apt-get update && apt-get install -y --no-install-recommends \
14+
ca-certificates \
15+
libsqlite3-0 \
16+
libssl1.0.0 \
17+
&& rm -rf /var/lib/apt/lists/*
18+
19+
ENV PYTHON_VERSION 3.6.0a2
20+
21+
# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'"
22+
ENV PYTHON_PIP_VERSION 8.1.2
23+
24+
RUN set -ex \
25+
&& buildDeps=' \
26+
curl \
27+
gcc \
28+
libbz2-dev \
29+
libc6-dev \
30+
liblzma-dev \
31+
libncurses-dev \
32+
libreadline-dev \
33+
libsqlite3-dev \
34+
libssl-dev \
35+
make \
36+
xz-utils \
37+
zlib1g-dev \
38+
' \
39+
&& apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \
40+
&& curl -fSL "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" -o python.tar.xz \
41+
&& curl -fSL "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc" -o python.tar.xz.asc \
42+
&& export GNUPGHOME="$(mktemp -d)" \
43+
&& gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPG_KEY" \
44+
&& gpg --batch --verify python.tar.xz.asc python.tar.xz \
45+
&& rm -r "$GNUPGHOME" python.tar.xz.asc \
46+
&& mkdir -p /usr/src/python \
47+
&& tar -xJC /usr/src/python --strip-components=1 -f python.tar.xz \
48+
&& rm python.tar.xz \
49+
\
50+
&& cd /usr/src/python \
51+
&& ./configure --enable-shared --enable-unicode=ucs4 \
52+
&& make -j$(nproc) \
53+
&& make install \
54+
&& ldconfig \
55+
&& pip3 install --no-cache-dir --upgrade pip==$PYTHON_PIP_VERSION \
56+
&& [ "$(pip list | awk -F '[ ()]+' '$1 == "pip" { print $2; exit }')" = "$PYTHON_PIP_VERSION" ] \
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+
&& apt-get purge -y --auto-remove $buildDeps \
64+
&& rm -rf /usr/src/python ~/.cache
65+
66+
# make some useful symlinks that are expected to exist
67+
RUN cd /usr/local/bin \
68+
&& ln -s easy_install-3.6 easy_install \
69+
&& ln -s idle3 idle \
70+
&& ln -s pydoc3 pydoc \
71+
&& ln -s python3 python \
72+
&& ln -s python3-config python-config
73+
74+
CMD ["python3"]

0 commit comments

Comments
 (0)