Skip to content

Commit 0b0fb40

Browse files
authored
Merge pull request #233 from infosiftr/debian-slim
Update slim variants to use slim Debian variants and add slim-stretch variants
2 parents 3f12f51 + 7891fcc commit 0b0fb40

File tree

10 files changed

+256
-11
lines changed

10 files changed

+256
-11
lines changed

.travis.yml

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ env:
66
- VERSION=3.7-rc VARIANT=stretch/slim
77
- VERSION=3.7-rc VARIANT=alpine3.6
88
- VERSION=3.6 VARIANT=stretch
9+
- VERSION=3.6 VARIANT=stretch/slim
910
- VERSION=3.6 VARIANT=jessie
1011
- VERSION=3.6 VARIANT=jessie/slim
1112
- VERSION=3.6 VARIANT=alpine3.6
@@ -18,6 +19,7 @@ env:
1819
- VERSION=3.4 VARIANT=wheezy
1920
- VERSION=3.4 VARIANT=alpine3.4
2021
- VERSION=2.7 VARIANT=stretch
22+
- VERSION=2.7 VARIANT=stretch/slim
2123
- VERSION=2.7 VARIANT=jessie
2224
- VERSION=2.7 VARIANT=jessie/slim
2325
- VERSION=2.7 VARIANT=wheezy

2.7/jessie/slim/Dockerfile

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM debian:jessie
1+
FROM debian:jessie-slim
22

33
# ensure local python is preferred over distribution python
44
ENV PATH /usr/local/bin:$PATH
@@ -19,7 +19,7 @@ ENV GPG_KEY C01E1CAD5EA2C4F0B8E3571504C367C218ADD4FF
1919
ENV PYTHON_VERSION 2.7.14
2020

2121
RUN set -ex \
22-
&& buildDeps=' \
22+
&& buildDeps=" \
2323
dpkg-dev \
2424
gcc \
2525
libbz2-dev \
@@ -36,7 +36,9 @@ RUN set -ex \
3636
wget \
3737
xz-utils \
3838
zlib1g-dev \
39-
' \
39+
# as of Stretch, "gpg" is no longer included by default
40+
$(command -v gpg > /dev/null || echo 'gnupg2 dirmngr') \
41+
" \
4042
&& apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \
4143
\
4244
&& wget -O python.tar.xz "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" \

2.7/stretch/slim/Dockerfile

+102
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
FROM debian:stretch-slim
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+
# runtime dependencies
11+
RUN apt-get update && apt-get install -y --no-install-recommends \
12+
ca-certificates \
13+
libgdbm3 \
14+
libsqlite3-0 \
15+
libssl1.1 \
16+
&& rm -rf /var/lib/apt/lists/*
17+
18+
ENV GPG_KEY C01E1CAD5EA2C4F0B8E3571504C367C218ADD4FF
19+
ENV PYTHON_VERSION 2.7.14
20+
21+
RUN set -ex \
22+
&& buildDeps=" \
23+
dpkg-dev \
24+
gcc \
25+
libbz2-dev \
26+
libc6-dev \
27+
libdb-dev \
28+
libgdbm-dev \
29+
libncurses-dev \
30+
libreadline-dev \
31+
libsqlite3-dev \
32+
libssl-dev \
33+
make \
34+
tcl-dev \
35+
tk-dev \
36+
wget \
37+
xz-utils \
38+
zlib1g-dev \
39+
# as of Stretch, "gpg" is no longer included by default
40+
$(command -v gpg > /dev/null || echo 'gnupg2 dirmngr') \
41+
" \
42+
&& apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \
43+
\
44+
&& wget -O python.tar.xz "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" \
45+
&& wget -O python.tar.xz.asc "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc" \
46+
&& export GNUPGHOME="$(mktemp -d)" \
47+
&& gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPG_KEY" \
48+
&& gpg --batch --verify python.tar.xz.asc python.tar.xz \
49+
&& rm -rf "$GNUPGHOME" python.tar.xz.asc \
50+
&& mkdir -p /usr/src/python \
51+
&& tar -xJC /usr/src/python --strip-components=1 -f python.tar.xz \
52+
&& rm python.tar.xz \
53+
\
54+
&& cd /usr/src/python \
55+
&& gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \
56+
&& ./configure \
57+
--build="$gnuArch" \
58+
--enable-shared \
59+
--enable-unicode=ucs4 \
60+
&& make -j "$(nproc)" \
61+
&& make install \
62+
&& ldconfig \
63+
\
64+
&& apt-get purge -y --auto-remove $buildDeps \
65+
\
66+
&& find /usr/local -depth \
67+
\( \
68+
\( -type d -a \( -name test -o -name tests \) \) \
69+
-o \
70+
\( -type f -a \( -name '*.pyc' -o -name '*.pyo' \) \) \
71+
\) -exec rm -rf '{}' + \
72+
&& rm -rf /usr/src/python
73+
74+
# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'"
75+
ENV PYTHON_PIP_VERSION 9.0.1
76+
77+
RUN set -ex; \
78+
\
79+
apt-get update; \
80+
apt-get install -y --no-install-recommends wget; \
81+
rm -rf /var/lib/apt/lists/*; \
82+
\
83+
wget -O get-pip.py 'https://bootstrap.pypa.io/get-pip.py'; \
84+
\
85+
apt-get purge -y --auto-remove wget; \
86+
\
87+
python get-pip.py \
88+
--disable-pip-version-check \
89+
--no-cache-dir \
90+
"pip==$PYTHON_PIP_VERSION" \
91+
; \
92+
pip --version; \
93+
\
94+
find /usr/local -depth \
95+
\( \
96+
\( -type d -a \( -name test -o -name tests \) \) \
97+
-o \
98+
\( -type f -a \( -name '*.pyc' -o -name '*.pyo' \) \) \
99+
\) -exec rm -rf '{}' +; \
100+
rm -f get-pip.py
101+
102+
CMD ["python2"]

3.4/jessie/slim/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# PLEASE DO NOT EDIT IT DIRECTLY.
55
#
66

7-
FROM debian:jessie
7+
FROM debian:jessie-slim
88

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

3.5/jessie/slim/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# PLEASE DO NOT EDIT IT DIRECTLY.
55
#
66

7-
FROM debian:jessie
7+
FROM debian:jessie-slim
88

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

3.6/jessie/slim/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# PLEASE DO NOT EDIT IT DIRECTLY.
55
#
66

7-
FROM debian:jessie
7+
FROM debian:jessie-slim
88

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

3.6/stretch/slim/Dockerfile

+122
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
#
2+
# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh"
3+
#
4+
# PLEASE DO NOT EDIT IT DIRECTLY.
5+
#
6+
7+
FROM debian:stretch-slim
8+
9+
# ensure local python is preferred over distribution python
10+
ENV PATH /usr/local/bin:$PATH
11+
12+
# http://bugs.python.org/issue19846
13+
# > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK.
14+
ENV LANG C.UTF-8
15+
16+
# runtime dependencies
17+
RUN apt-get update && apt-get install -y --no-install-recommends \
18+
ca-certificates \
19+
libexpat1 \
20+
libffi6 \
21+
libgdbm3 \
22+
libsqlite3-0 \
23+
libssl1.1 \
24+
&& rm -rf /var/lib/apt/lists/*
25+
26+
ENV GPG_KEY 0D96DF4D4110E5C43FBFB17F2D347EA6AA65421D
27+
ENV PYTHON_VERSION 3.6.3
28+
29+
RUN set -ex \
30+
&& buildDeps=" \
31+
dpkg-dev \
32+
gcc \
33+
libbz2-dev \
34+
libc6-dev \
35+
libexpat1-dev \
36+
libffi-dev \
37+
libgdbm-dev \
38+
liblzma-dev \
39+
libncurses-dev \
40+
libreadline-dev \
41+
libsqlite3-dev \
42+
libssl-dev \
43+
make \
44+
tcl-dev \
45+
tk-dev \
46+
wget \
47+
xz-utils \
48+
zlib1g-dev \
49+
# as of Stretch, "gpg" is no longer included by default
50+
$(command -v gpg > /dev/null || echo 'gnupg2 dirmngr') \
51+
" \
52+
&& apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \
53+
\
54+
&& wget -O python.tar.xz "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" \
55+
&& wget -O python.tar.xz.asc "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc" \
56+
&& export GNUPGHOME="$(mktemp -d)" \
57+
&& gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPG_KEY" \
58+
&& gpg --batch --verify python.tar.xz.asc python.tar.xz \
59+
&& rm -rf "$GNUPGHOME" python.tar.xz.asc \
60+
&& mkdir -p /usr/src/python \
61+
&& tar -xJC /usr/src/python --strip-components=1 -f python.tar.xz \
62+
&& rm python.tar.xz \
63+
\
64+
&& cd /usr/src/python \
65+
&& gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \
66+
&& ./configure \
67+
--build="$gnuArch" \
68+
--enable-loadable-sqlite-extensions \
69+
--enable-shared \
70+
--with-system-expat \
71+
--with-system-ffi \
72+
--without-ensurepip \
73+
&& make -j "$(nproc)" \
74+
&& make install \
75+
&& ldconfig \
76+
\
77+
&& apt-get purge -y --auto-remove $buildDeps \
78+
\
79+
&& find /usr/local -depth \
80+
\( \
81+
\( -type d -a \( -name test -o -name tests \) \) \
82+
-o \
83+
\( -type f -a \( -name '*.pyc' -o -name '*.pyo' \) \) \
84+
\) -exec rm -rf '{}' + \
85+
&& rm -rf /usr/src/python
86+
87+
# make some useful symlinks that are expected to exist
88+
RUN cd /usr/local/bin \
89+
&& ln -s idle3 idle \
90+
&& ln -s pydoc3 pydoc \
91+
&& ln -s python3 python \
92+
&& ln -s python3-config python-config
93+
94+
# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'"
95+
ENV PYTHON_PIP_VERSION 9.0.1
96+
97+
RUN set -ex; \
98+
\
99+
apt-get update; \
100+
apt-get install -y --no-install-recommends wget; \
101+
rm -rf /var/lib/apt/lists/*; \
102+
\
103+
wget -O get-pip.py 'https://bootstrap.pypa.io/get-pip.py'; \
104+
\
105+
apt-get purge -y --auto-remove wget; \
106+
\
107+
python get-pip.py \
108+
--disable-pip-version-check \
109+
--no-cache-dir \
110+
"pip==$PYTHON_PIP_VERSION" \
111+
; \
112+
pip --version; \
113+
\
114+
find /usr/local -depth \
115+
\( \
116+
\( -type d -a \( -name test -o -name tests \) \) \
117+
-o \
118+
\( -type f -a \( -name '*.pyc' -o -name '*.pyo' \) \) \
119+
\) -exec rm -rf '{}' +; \
120+
rm -f get-pip.py
121+
122+
CMD ["python3"]

3.7-rc/stretch/slim/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# PLEASE DO NOT EDIT IT DIRECTLY.
55
#
66

7-
FROM debian:stretch
7+
FROM debian:stretch-slim
88

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

generate-stackbrew-library.sh

+17-4
Original file line numberDiff line numberDiff line change
@@ -97,15 +97,23 @@ for version in "${versions[@]}"; do
9797
dir="$version/$v"
9898
variant="$(basename "$v")"
9999

100+
if [ "$variant" = 'slim' ]; then
101+
# convert "slim" into "slim-jessie"
102+
# https://github.com/docker-library/ruby/pull/142#issuecomment-320012893
103+
variant="$variant-$(basename "$(dirname "$v")")"
104+
fi
105+
100106
[ -f "$dir/Dockerfile" ] || continue
101107

102108
commit="$(dirCommit "$dir")"
103109

104110
versionDockerfile="$dir/Dockerfile"
111+
versionCommit="$commit"
105112
if [ "$variant" = 'onbuild' ]; then
106113
versionDockerfile="$(dirname "$dir")/Dockerfile"
114+
versionCommit="$(dirCommit "$(dirname "$versionDockerfile")")"
107115
fi
108-
fullVersion="$(git show "$commit":"$versionDockerfile" | awk '$1 == "ENV" && $2 == "PYTHON_VERSION" { print $3; exit }')"
116+
fullVersion="$(git show "$versionCommit":"$versionDockerfile" | awk '$1 == "ENV" && $2 == "PYTHON_VERSION" { print $3; exit }')"
109117

110118
versionAliases=(
111119
$fullVersion
@@ -114,9 +122,14 @@ for version in "${versions[@]}"; do
114122
)
115123

116124
variantAliases=( "${versionAliases[@]/%/-$variant}" )
117-
if [ "$variant" = "alpine${alpineVersion}" ]; then
118-
variantAliases+=( "${versionAliases[@]/%/-alpine}" )
119-
fi
125+
case "$variant" in
126+
*-"$debianSuite") # "slim-stretch", etc need "slim"
127+
variantAliases+=( "${versionAliases[@]/%/-${variant%-$debianSuite}}" )
128+
;;
129+
"alpine${alpineVersion}")
130+
variantAliases+=( "${versionAliases[@]/%/-alpine}" )
131+
;;
132+
esac
120133
variantAliases=( "${variantAliases[@]//latest-/}" )
121134

122135
case "$v" in

update.sh

+4
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,10 @@ for version in "${versions[@]}"; do
111111
alpine*) template='alpine'; tag="${variant#alpine}" ;;
112112
*) template='debian'; tag="$variant" ;;
113113
esac
114+
if [ "$variant" = 'slim' ]; then
115+
# use "debian:*-slim" variants for "python:*-slim" variants
116+
tag+='-slim'
117+
fi
114118
template="Dockerfile-${template}.template"
115119

116120
if [[ "$version" == 2.* ]]; then

0 commit comments

Comments
 (0)