Skip to content

Commit 01d9728

Browse files
committed
Add slim variants
1 parent c1ddfbe commit 01d9728

File tree

5 files changed

+119
-2
lines changed

5 files changed

+119
-2
lines changed

2.7/slim/Dockerfile

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
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 ca-certificates libssl1.0.0 --no-install-recommends && rm -rf /var/lib/apt/lists/*
11+
12+
ENV PYTHON_VERSION 2.7.8
13+
14+
RUN set -x \
15+
&& buildDeps='curl gcc libc6-dev libssl-dev make xz-utils zlib1g-dev' \
16+
&& apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \
17+
&& mkdir -p /usr/src/python \
18+
&& curl -SL "https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tar.xz" \
19+
| tar -xJC /usr/src/python --strip-components=1 \
20+
&& cd /usr/src/python \
21+
&& ./configure --enable-shared \
22+
&& make -j$(nproc) \
23+
&& make install \
24+
&& ldconfig \
25+
&& curl -SL 'https://bootstrap.pypa.io/get-pip.py' | python2 \
26+
&& find /usr/local \
27+
\( -type d -a -name test -o -name tests \) \
28+
-o \( -type f -a -name '*.pyc' -o -name '*.pyo' \) \
29+
-exec rm -rf '{}' + \
30+
&& apt-get purge -y --auto-remove $buildDeps \
31+
&& rm -rf /usr/src/python
32+
33+
# install "virtualenv", since the vast majority of users of this image will want it
34+
RUN pip install virtualenv
35+
36+
CMD ["python2"]

3.3/slim/Dockerfile

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
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 ca-certificates libssl1.0.0 --no-install-recommends && rm -rf /var/lib/apt/lists/*
11+
12+
ENV PYTHON_VERSION 3.3.6
13+
14+
RUN set -x \
15+
&& buildDeps='curl gcc libc6-dev libssl-dev make xz-utils zlib1g-dev' \
16+
&& apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \
17+
&& mkdir -p /usr/src/python \
18+
&& curl -SL "https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tar.xz" \
19+
| tar -xJC /usr/src/python --strip-components=1 \
20+
&& cd /usr/src/python \
21+
&& ./configure --enable-shared \
22+
&& make -j$(nproc) \
23+
&& make install \
24+
&& ldconfig \
25+
&& curl -SL 'https://bootstrap.pypa.io/get-pip.py' | python3 \
26+
&& find /usr/local \
27+
\( -type d -a -name test -o -name tests \) \
28+
-o \( -type f -a -name '*.pyc' -o -name '*.pyo' \) \
29+
-exec rm -rf '{}' + \
30+
&& apt-get purge -y --auto-remove $buildDeps \
31+
&& rm -rf /usr/src/python
32+
33+
# make some useful symlinks that are expected to exist
34+
RUN cd /usr/local/bin \
35+
&& ln -s idle3 idle \
36+
&& ln -s pydoc3 pydoc \
37+
&& ln -s python3 python \
38+
&& ln -s python-config3 python-config
39+
40+
CMD ["python3"]

3.4/slim/Dockerfile

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
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 ca-certificates libssl1.0.0 --no-install-recommends && rm -rf /var/lib/apt/lists/*
11+
12+
ENV PYTHON_VERSION 3.4.2
13+
14+
RUN set -x \
15+
&& buildDeps='curl gcc libc6-dev libssl-dev make xz-utils zlib1g-dev' \
16+
&& apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \
17+
&& mkdir -p /usr/src/python \
18+
&& curl -SL "https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tar.xz" \
19+
| tar -xJC /usr/src/python --strip-components=1 \
20+
&& cd /usr/src/python \
21+
&& ./configure --enable-shared \
22+
&& make -j$(nproc) \
23+
&& make install \
24+
&& ldconfig \
25+
&& find /usr/local \
26+
\( -type d -a -name test -o -name tests \) \
27+
-o \( -type f -a -name '*.pyc' -o -name '*.pyo' \) \
28+
-exec rm -rf '{}' + \
29+
&& apt-get purge -y --auto-remove $buildDeps \
30+
&& rm -rf /usr/src/python
31+
32+
# make some useful symlinks that are expected to exist
33+
RUN cd /usr/local/bin \
34+
&& ln -s easy_install-3.4 easy_install \
35+
&& ln -s idle3 idle \
36+
&& ln -s pip3 pip \
37+
&& ln -s pydoc3 pydoc \
38+
&& ln -s python3 python \
39+
&& ln -s python-config3 python-config
40+
41+
CMD ["python3"]

generate-stackbrew-library.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ for version in "${versions[@]}"; do
2525
echo "$va: ${url}@${commit} $version"
2626
done
2727

28-
for variant in onbuild; do
28+
for variant in onbuild slim; do
2929
commit="$(git log -1 --format='format:%H' -- "$version/$variant")"
3030
echo
3131
for va in "${versionAliases[@]}"; do

update.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ for version in "${versions[@]}"; do
1515
fullVersion="$(curl -sSL 'https://www.python.org/downloads/' | awk -F 'Python |</a>' '/<span class="release-number"><a[^>]+>Python '"$version"'./ { print $2 }' | sort -V | tail -1)"
1616
(
1717
set -x
18-
sed -ri 's/^(ENV PYTHON_VERSION) .*/\1 '"$fullVersion"'/' "$version/Dockerfile"
18+
sed -ri 's/^(ENV PYTHON_VERSION) .*/\1 '"$fullVersion"'/' "$version/Dockerfile" "$version/slim/Dockerfile"
1919
sed -ri 's/^(FROM python):.*/\1:'"$fullVersion"'/' "$version/onbuild/Dockerfile"
2020
)
2121
done

0 commit comments

Comments
 (0)