Skip to content

Commit c1ddfbe

Browse files
committed
Merge pull request #23 from infosiftr/smaller-shared-consistency
Add `--enable-shared`, slightly smaller images, and slightly better consistency across Dockerfiles
2 parents be49cab + 4faf7f1 commit c1ddfbe

File tree

3 files changed

+33
-26
lines changed

3 files changed

+33
-26
lines changed

2.7/Dockerfile

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,31 @@
1-
FROM buildpack-deps
2-
3-
RUN apt-get update && apt-get install -y curl procps
1+
FROM buildpack-deps:jessie
42

53
# remove several traces of debian python
6-
RUN apt-get purge -y python python-minimal python2.7-minimal
4+
RUN apt-get purge -y python.*
75

86
# http://bugs.python.org/issue19846
97
# > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK.
108
ENV LANG C.UTF-8
119

1210
ENV PYTHON_VERSION 2.7.8
1311

14-
RUN mkdir -p /usr/src/python \
12+
RUN set -x \
13+
&& mkdir -p /usr/src/python \
1514
&& curl -SL "https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tar.xz" \
1615
| tar -xJC /usr/src/python --strip-components=1 \
1716
&& cd /usr/src/python \
18-
&& ./configure \
17+
&& ./configure --enable-shared \
1918
&& make -j$(nproc) \
2019
&& make install \
21-
&& cd / \
20+
&& ldconfig \
21+
&& curl -SL 'https://bootstrap.pypa.io/get-pip.py' | python2 \
22+
&& find /usr/local \
23+
\( -type d -a -name test -o -name tests \) \
24+
-o \( -type f -a -name '*.pyc' -o -name '*.pyo' \) \
25+
-exec rm -rf '{}' + \
2226
&& rm -rf /usr/src/python
2327

24-
# install "pip" and "virtualenv", since the vast majority of users of this image will want it
25-
RUN curl -SL 'https://bootstrap.pypa.io/get-pip.py' | python2
28+
# install "virtualenv", since the vast majority of users of this image will want it
2629
RUN pip install virtualenv
2730

2831
CMD ["python2"]

3.3/Dockerfile

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,35 @@
1-
FROM buildpack-deps
2-
3-
RUN apt-get update && apt-get install -y curl procps
1+
FROM buildpack-deps:jessie
42

53
# remove several traces of debian python
6-
RUN apt-get purge -y python python-minimal python2.7-minimal
4+
RUN apt-get purge -y python.*
75

86
# http://bugs.python.org/issue19846
97
# > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK.
108
ENV LANG C.UTF-8
119

1210
ENV PYTHON_VERSION 3.3.6
1311

14-
RUN mkdir -p /usr/src/python \
12+
RUN set -x \
13+
&& mkdir -p /usr/src/python \
1514
&& curl -SL "https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tar.xz" \
1615
| tar -xJC /usr/src/python --strip-components=1 \
1716
&& cd /usr/src/python \
18-
&& ./configure \
17+
&& ./configure --enable-shared \
1918
&& make -j$(nproc) \
2019
&& make install \
21-
&& cd / \
20+
&& ldconfig \
21+
&& curl -SL 'https://bootstrap.pypa.io/get-pip.py' | python3 \
22+
&& find /usr/local \
23+
\( -type d -a -name test -o -name tests \) \
24+
-o \( -type f -a -name '*.pyc' -o -name '*.pyo' \) \
25+
-exec rm -rf '{}' + \
2226
&& rm -rf /usr/src/python
2327

2428
# make some useful symlinks that are expected to exist
2529
RUN cd /usr/local/bin \
26-
&& ln -s easy_install-3.4 easy_install \
2730
&& ln -s idle3 idle \
2831
&& ln -s pydoc3 pydoc \
2932
&& ln -s python3 python \
3033
&& ln -s python-config3 python-config
3134

32-
RUN curl -SL 'https://bootstrap.pypa.io/get-pip.py' | python3
33-
3435
CMD ["python3"]

3.4/Dockerfile

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,27 @@
1-
FROM buildpack-deps
2-
3-
RUN apt-get update && apt-get install -y curl procps
1+
FROM buildpack-deps:jessie
42

53
# remove several traces of debian python
6-
RUN apt-get purge -y python python-minimal python2.7-minimal
4+
RUN apt-get purge -y python.*
75

86
# http://bugs.python.org/issue19846
97
# > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK.
108
ENV LANG C.UTF-8
119

1210
ENV PYTHON_VERSION 3.4.2
1311

14-
RUN mkdir -p /usr/src/python \
12+
RUN set -x \
13+
&& mkdir -p /usr/src/python \
1514
&& curl -SL "https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tar.xz" \
1615
| tar -xJC /usr/src/python --strip-components=1 \
1716
&& cd /usr/src/python \
18-
&& ./configure \
17+
&& ./configure --enable-shared \
1918
&& make -j$(nproc) \
2019
&& make install \
21-
&& cd / \
20+
&& ldconfig \
21+
&& find /usr/local \
22+
\( -type d -a -name test -o -name tests \) \
23+
-o \( -type f -a -name '*.pyc' -o -name '*.pyo' \) \
24+
-exec rm -rf '{}' + \
2225
&& rm -rf /usr/src/python
2326

2427
# make some useful symlinks that are expected to exist

0 commit comments

Comments
 (0)