Add `--enable-shared`, slightly smaller images, and slightly better consistency across Dockerfiles

This commit is contained in:
Tianon Gravi 2014-11-26 10:30:53 -07:00
parent be49cab808
commit 4faf7f1b13
3 changed files with 33 additions and 26 deletions

View File

@ -1,9 +1,7 @@
FROM buildpack-deps
RUN apt-get update && apt-get install -y curl procps
FROM buildpack-deps:jessie
# remove several traces of debian python
RUN apt-get purge -y python python-minimal python2.7-minimal
RUN apt-get purge -y python.*
# http://bugs.python.org/issue19846
# > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK.
@ -11,18 +9,23 @@ ENV LANG C.UTF-8
ENV PYTHON_VERSION 2.7.8
RUN mkdir -p /usr/src/python \
RUN set -x \
&& mkdir -p /usr/src/python \
&& curl -SL "https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tar.xz" \
| tar -xJC /usr/src/python --strip-components=1 \
&& cd /usr/src/python \
&& ./configure \
&& ./configure --enable-shared \
&& make -j$(nproc) \
&& make install \
&& cd / \
&& ldconfig \
&& curl -SL 'https://bootstrap.pypa.io/get-pip.py' | python2 \
&& find /usr/local \
\( -type d -a -name test -o -name tests \) \
-o \( -type f -a -name '*.pyc' -o -name '*.pyo' \) \
-exec rm -rf '{}' + \
&& rm -rf /usr/src/python
# install "pip" and "virtualenv", since the vast majority of users of this image will want it
RUN curl -SL 'https://bootstrap.pypa.io/get-pip.py' | python2
# install "virtualenv", since the vast majority of users of this image will want it
RUN pip install virtualenv
CMD ["python2"]

View File

@ -1,9 +1,7 @@
FROM buildpack-deps
RUN apt-get update && apt-get install -y curl procps
FROM buildpack-deps:jessie
# remove several traces of debian python
RUN apt-get purge -y python python-minimal python2.7-minimal
RUN apt-get purge -y python.*
# http://bugs.python.org/issue19846
# > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK.
@ -11,24 +9,27 @@ ENV LANG C.UTF-8
ENV PYTHON_VERSION 3.3.6
RUN mkdir -p /usr/src/python \
RUN set -x \
&& mkdir -p /usr/src/python \
&& curl -SL "https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tar.xz" \
| tar -xJC /usr/src/python --strip-components=1 \
&& cd /usr/src/python \
&& ./configure \
&& ./configure --enable-shared \
&& make -j$(nproc) \
&& make install \
&& cd / \
&& ldconfig \
&& curl -SL 'https://bootstrap.pypa.io/get-pip.py' | python3 \
&& find /usr/local \
\( -type d -a -name test -o -name tests \) \
-o \( -type f -a -name '*.pyc' -o -name '*.pyo' \) \
-exec rm -rf '{}' + \
&& rm -rf /usr/src/python
# make some useful symlinks that are expected to exist
RUN cd /usr/local/bin \
&& ln -s easy_install-3.4 easy_install \
&& ln -s idle3 idle \
&& ln -s pydoc3 pydoc \
&& ln -s python3 python \
&& ln -s python-config3 python-config
RUN curl -SL 'https://bootstrap.pypa.io/get-pip.py' | python3
CMD ["python3"]

View File

@ -1,9 +1,7 @@
FROM buildpack-deps
RUN apt-get update && apt-get install -y curl procps
FROM buildpack-deps:jessie
# remove several traces of debian python
RUN apt-get purge -y python python-minimal python2.7-minimal
RUN apt-get purge -y python.*
# http://bugs.python.org/issue19846
# > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK.
@ -11,14 +9,19 @@ ENV LANG C.UTF-8
ENV PYTHON_VERSION 3.4.2
RUN mkdir -p /usr/src/python \
RUN set -x \
&& mkdir -p /usr/src/python \
&& curl -SL "https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tar.xz" \
| tar -xJC /usr/src/python --strip-components=1 \
&& cd /usr/src/python \
&& ./configure \
&& ./configure --enable-shared \
&& make -j$(nproc) \
&& make install \
&& cd / \
&& ldconfig \
&& find /usr/local \
\( -type d -a -name test -o -name tests \) \
-o \( -type f -a -name '*.pyc' -o -name '*.pyo' \) \
-exec rm -rf '{}' + \
&& rm -rf /usr/src/python
# make some useful symlinks that are expected to exist