Skip to content

Commit 1565b7e

Browse files
authored
Merge pull request #315 from infosiftr/caveman-templates
Add templates for Python 2.7
2 parents 48284b4 + 6ec65c2 commit 1565b7e

File tree

15 files changed

+442
-17
lines changed

15 files changed

+442
-17
lines changed

2.7/alpine3.6/Dockerfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
#
2+
# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh"
3+
#
4+
# PLEASE DO NOT EDIT IT DIRECTLY.
5+
#
6+
17
FROM alpine:3.6
28

39
# ensure local python is preferred over distribution python
@@ -28,6 +34,7 @@ RUN set -ex \
2834
&& export GNUPGHOME="$(mktemp -d)" \
2935
&& gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPG_KEY" \
3036
&& gpg --batch --verify python.tar.xz.asc python.tar.xz \
37+
&& { command -v gpgconf > /dev/null && gpgconf --kill all || :; } \
3138
&& rm -rf "$GNUPGHOME" python.tar.xz.asc \
3239
&& mkdir -p /usr/src/python \
3340
&& tar -xJC /usr/src/python --strip-components=1 -f python.tar.xz \

2.7/alpine3.7/Dockerfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
#
2+
# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh"
3+
#
4+
# PLEASE DO NOT EDIT IT DIRECTLY.
5+
#
6+
17
FROM alpine:3.7
28

39
# ensure local python is preferred over distribution python
@@ -28,6 +34,7 @@ RUN set -ex \
2834
&& export GNUPGHOME="$(mktemp -d)" \
2935
&& gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPG_KEY" \
3036
&& gpg --batch --verify python.tar.xz.asc python.tar.xz \
37+
&& { command -v gpgconf > /dev/null && gpgconf --kill all || :; } \
3138
&& rm -rf "$GNUPGHOME" python.tar.xz.asc \
3239
&& mkdir -p /usr/src/python \
3340
&& tar -xJC /usr/src/python --strip-components=1 -f python.tar.xz \

2.7/alpine3.8/Dockerfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
#
2+
# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh"
3+
#
4+
# PLEASE DO NOT EDIT IT DIRECTLY.
5+
#
6+
17
FROM alpine:3.8
28

39
# ensure local python is preferred over distribution python
@@ -28,6 +34,7 @@ RUN set -ex \
2834
&& export GNUPGHOME="$(mktemp -d)" \
2935
&& gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPG_KEY" \
3036
&& gpg --batch --verify python.tar.xz.asc python.tar.xz \
37+
&& { command -v gpgconf > /dev/null && gpgconf --kill all || :; } \
3138
&& rm -rf "$GNUPGHOME" python.tar.xz.asc \
3239
&& mkdir -p /usr/src/python \
3340
&& tar -xJC /usr/src/python --strip-components=1 -f python.tar.xz \

2.7/jessie/Dockerfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
#
2+
# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh"
3+
#
4+
# PLEASE DO NOT EDIT IT DIRECTLY.
5+
#
6+
17
FROM buildpack-deps:jessie
28

39
# ensure local python is preferred over distribution python
@@ -24,6 +30,7 @@ RUN set -ex \
2430
&& export GNUPGHOME="$(mktemp -d)" \
2531
&& gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPG_KEY" \
2632
&& gpg --batch --verify python.tar.xz.asc python.tar.xz \
33+
&& { command -v gpgconf > /dev/null && gpgconf --kill all || :; } \
2734
&& rm -rf "$GNUPGHOME" python.tar.xz.asc \
2835
&& mkdir -p /usr/src/python \
2936
&& tar -xJC /usr/src/python --strip-components=1 -f python.tar.xz \

2.7/jessie/slim/Dockerfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
#
2+
# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh"
3+
#
4+
# PLEASE DO NOT EDIT IT DIRECTLY.
5+
#
6+
17
FROM debian:jessie-slim
28

39
# ensure local python is preferred over distribution python
@@ -46,6 +52,7 @@ RUN set -ex \
4652
&& export GNUPGHOME="$(mktemp -d)" \
4753
&& gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPG_KEY" \
4854
&& gpg --batch --verify python.tar.xz.asc python.tar.xz \
55+
&& { command -v gpgconf > /dev/null && gpgconf --kill all || :; } \
4956
&& rm -rf "$GNUPGHOME" python.tar.xz.asc \
5057
&& mkdir -p /usr/src/python \
5158
&& tar -xJC /usr/src/python --strip-components=1 -f python.tar.xz \

2.7/stretch/Dockerfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
#
2+
# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh"
3+
#
4+
# PLEASE DO NOT EDIT IT DIRECTLY.
5+
#
6+
17
FROM buildpack-deps:stretch
28

39
# ensure local python is preferred over distribution python
@@ -24,6 +30,7 @@ RUN set -ex \
2430
&& export GNUPGHOME="$(mktemp -d)" \
2531
&& gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPG_KEY" \
2632
&& gpg --batch --verify python.tar.xz.asc python.tar.xz \
33+
&& { command -v gpgconf > /dev/null && gpgconf --kill all || :; } \
2734
&& rm -rf "$GNUPGHOME" python.tar.xz.asc \
2835
&& mkdir -p /usr/src/python \
2936
&& tar -xJC /usr/src/python --strip-components=1 -f python.tar.xz \

2.7/stretch/slim/Dockerfile

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
#
2+
# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh"
3+
#
4+
# PLEASE DO NOT EDIT IT DIRECTLY.
5+
#
6+
17
FROM debian:stretch-slim
28

39
# ensure local python is preferred over distribution python
@@ -12,10 +18,6 @@ ENV PYTHONIOENCODING UTF-8
1218
# runtime dependencies
1319
RUN apt-get update && apt-get install -y --no-install-recommends \
1420
ca-certificates \
15-
libgdbm3 \
16-
libreadline7 \
17-
libsqlite3-0 \
18-
libssl1.1 \
1921
netbase \
2022
&& rm -rf /var/lib/apt/lists/*
2123

@@ -50,6 +52,7 @@ RUN set -ex \
5052
&& export GNUPGHOME="$(mktemp -d)" \
5153
&& gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPG_KEY" \
5254
&& gpg --batch --verify python.tar.xz.asc python.tar.xz \
55+
&& { command -v gpgconf > /dev/null && gpgconf --kill all || :; } \
5356
&& rm -rf "$GNUPGHOME" python.tar.xz.asc \
5457
&& mkdir -p /usr/src/python \
5558
&& tar -xJC /usr/src/python --strip-components=1 -f python.tar.xz \

2.7/wheezy/Dockerfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
#
2+
# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh"
3+
#
4+
# PLEASE DO NOT EDIT IT DIRECTLY.
5+
#
6+
17
FROM buildpack-deps:wheezy
28

39
# ensure local python is preferred over distribution python
@@ -24,6 +30,7 @@ RUN set -ex \
2430
&& export GNUPGHOME="$(mktemp -d)" \
2531
&& gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPG_KEY" \
2632
&& gpg --batch --verify python.tar.xz.asc python.tar.xz \
33+
&& { command -v gpgconf > /dev/null && gpgconf --kill all || :; } \
2734
&& rm -rf "$GNUPGHOME" python.tar.xz.asc \
2835
&& mkdir -p /usr/src/python \
2936
&& tar -xJC /usr/src/python --strip-components=1 -f python.tar.xz \

2.7/windows/windowsservercore-1709/Dockerfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
#
2+
# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh"
3+
#
4+
# PLEASE DO NOT EDIT IT DIRECTLY.
5+
#
6+
17
FROM microsoft/windowsservercore:1709
28

39
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]

2.7/windows/windowsservercore-ltsc2016/Dockerfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
#
2+
# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh"
3+
#
4+
# PLEASE DO NOT EDIT IT DIRECTLY.
5+
#
6+
17
FROM microsoft/windowsservercore:ltsc2016
28

39
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]

Dockerfile-caveman-alpine.template

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
FROM alpine:%%PLACEHOLDER%%
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+
# https://github.com/docker-library/python/issues/147
10+
ENV PYTHONIOENCODING UTF-8
11+
12+
# install ca-certificates so that HTTPS works consistently
13+
# the other runtime dependencies for Python are installed later
14+
RUN apk add --no-cache ca-certificates
15+
16+
ENV GPG_KEY %%PLACEHOLDER%%
17+
ENV PYTHON_VERSION %%PLACEHOLDER%%
18+
19+
RUN set -ex \
20+
&& apk add --no-cache --virtual .fetch-deps \
21+
gnupg \
22+
libressl \
23+
tar \
24+
xz \
25+
\
26+
&& wget -O python.tar.xz "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" \
27+
&& wget -O python.tar.xz.asc "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc" \
28+
&& export GNUPGHOME="$(mktemp -d)" \
29+
&& gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPG_KEY" \
30+
&& gpg --batch --verify python.tar.xz.asc python.tar.xz \
31+
&& { command -v gpgconf > /dev/null && gpgconf --kill all || :; } \
32+
&& rm -rf "$GNUPGHOME" python.tar.xz.asc \
33+
&& mkdir -p /usr/src/python \
34+
&& tar -xJC /usr/src/python --strip-components=1 -f python.tar.xz \
35+
&& rm python.tar.xz \
36+
\
37+
&& apk add --no-cache --virtual .build-deps \
38+
bzip2-dev \
39+
coreutils \
40+
dpkg-dev dpkg \
41+
findutils \
42+
gcc \
43+
gdbm-dev \
44+
libc-dev \
45+
libnsl-dev \
46+
libressl \
47+
libressl-dev \
48+
libtirpc-dev \
49+
linux-headers \
50+
make \
51+
ncurses-dev \
52+
pax-utils \
53+
readline-dev \
54+
sqlite-dev \
55+
tcl-dev \
56+
tk \
57+
tk-dev \
58+
zlib-dev \
59+
# add build deps before removing fetch deps in case there's overlap
60+
&& apk del .fetch-deps \
61+
\
62+
&& cd /usr/src/python \
63+
&& gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \
64+
&& ./configure \
65+
--build="$gnuArch" \
66+
--enable-shared \
67+
--enable-unicode=ucs4 \
68+
&& make -j "$(nproc)" \
69+
# set thread stack size to 1MB so we don't segfault before we hit sys.getrecursionlimit()
70+
# https://github.com/alpinelinux/aports/commit/2026e1259422d4e0cf92391ca2d3844356c649d0
71+
EXTRA_CFLAGS="-DTHREAD_STACK_SIZE=0x100000" \
72+
&& make install \
73+
\
74+
&& find /usr/local -type f -executable -not \( -name '*tkinter*' \) -exec scanelf --needed --nobanner --format '%n#p' '{}' ';' \
75+
| tr ',' '\n' \
76+
| sort -u \
77+
| awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
78+
| xargs -rt apk add --virtual .python-rundeps \
79+
&& apk del .build-deps \
80+
\
81+
&& find /usr/local -depth \
82+
\( \
83+
\( -type d -a \( -name test -o -name tests \) \) \
84+
-o \
85+
\( -type f -a \( -name '*.pyc' -o -name '*.pyo' \) \) \
86+
\) -exec rm -rf '{}' + \
87+
&& rm -rf /usr/src/python \
88+
\
89+
&& python2 --version
90+
91+
# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'"
92+
ENV PYTHON_PIP_VERSION %%PLACEHOLDER%%
93+
94+
RUN set -ex; \
95+
\
96+
apk add --no-cache --virtual .fetch-deps libressl; \
97+
\
98+
wget -O get-pip.py 'https://bootstrap.pypa.io/get-pip.py'; \
99+
\
100+
apk del .fetch-deps; \
101+
\
102+
python get-pip.py \
103+
--disable-pip-version-check \
104+
--no-cache-dir \
105+
"pip==$PYTHON_PIP_VERSION" \
106+
; \
107+
pip --version; \
108+
\
109+
find /usr/local -depth \
110+
\( \
111+
\( -type d -a \( -name test -o -name tests \) \) \
112+
-o \
113+
\( -type f -a \( -name '*.pyc' -o -name '*.pyo' \) \) \
114+
\) -exec rm -rf '{}' +; \
115+
rm -f get-pip.py
116+
117+
CMD ["python2"]

Dockerfile-caveman-debian.template

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
FROM buildpack-deps:%%PLACEHOLDER%%
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+
# https://github.com/docker-library/python/issues/147
10+
ENV PYTHONIOENCODING UTF-8
11+
12+
# extra dependencies (over what buildpack-deps already includes)
13+
RUN apt-get update && apt-get install -y --no-install-recommends \
14+
tk-dev \
15+
&& rm -rf /var/lib/apt/lists/*
16+
17+
ENV GPG_KEY %%PLACEHOLDER%%
18+
ENV PYTHON_VERSION %%PLACEHOLDER%%
19+
20+
RUN set -ex \
21+
\
22+
&& wget -O python.tar.xz "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" \
23+
&& wget -O python.tar.xz.asc "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc" \
24+
&& export GNUPGHOME="$(mktemp -d)" \
25+
&& gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPG_KEY" \
26+
&& gpg --batch --verify python.tar.xz.asc python.tar.xz \
27+
&& { command -v gpgconf > /dev/null && gpgconf --kill all || :; } \
28+
&& rm -rf "$GNUPGHOME" python.tar.xz.asc \
29+
&& mkdir -p /usr/src/python \
30+
&& tar -xJC /usr/src/python --strip-components=1 -f python.tar.xz \
31+
&& rm python.tar.xz \
32+
\
33+
&& cd /usr/src/python \
34+
&& gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \
35+
&& ./configure \
36+
--build="$gnuArch" \
37+
--enable-shared \
38+
--enable-unicode=ucs4 \
39+
&& make -j "$(nproc)" \
40+
&& make install \
41+
&& ldconfig \
42+
\
43+
&& find /usr/local -depth \
44+
\( \
45+
\( -type d -a \( -name test -o -name tests \) \) \
46+
-o \
47+
\( -type f -a \( -name '*.pyc' -o -name '*.pyo' \) \) \
48+
\) -exec rm -rf '{}' + \
49+
&& rm -rf /usr/src/python \
50+
\
51+
&& python2 --version
52+
53+
# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'"
54+
ENV PYTHON_PIP_VERSION %%PLACEHOLDER%%
55+
56+
RUN set -ex; \
57+
\
58+
wget -O get-pip.py 'https://bootstrap.pypa.io/get-pip.py'; \
59+
\
60+
python get-pip.py \
61+
--disable-pip-version-check \
62+
--no-cache-dir \
63+
"pip==$PYTHON_PIP_VERSION" \
64+
; \
65+
pip --version; \
66+
\
67+
find /usr/local -depth \
68+
\( \
69+
\( -type d -a \( -name test -o -name tests \) \) \
70+
-o \
71+
\( -type f -a \( -name '*.pyc' -o -name '*.pyo' \) \) \
72+
\) -exec rm -rf '{}' +; \
73+
rm -f get-pip.py
74+
75+
# install "virtualenv", since the vast majority of users of this image will want it
76+
RUN pip install --no-cache-dir virtualenv
77+
78+
CMD ["python2"]

0 commit comments

Comments
 (0)