-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Python 2.7 Alpine variant #80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
A couple useful diffs: $ diff -u 2.7/slim/Dockerfile <(curl -fsSL 'https://raw.githubusercontent.com/Soullivaneuh/python/2.7-alpine/2.7/alpine/Dockerfile')
--- 2.7/slim/Dockerfile 2016-01-11 12:19:23.005163475 -0800
+++ /dev/fd/63 2016-01-12 08:23:00.535696053 -0800
@@ -1,62 +1,57 @@
-FROM debian:jessie
-
-# remove several traces of debian python
-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.
-ENV LANG C.UTF-8
-
-RUN apt-get update && apt-get install -y --no-install-recommends \
- ca-certificates \
- libsqlite3-0 \
- libssl1.0.0 \
- && rm -rf /var/lib/apt/lists/*
+FROM alpine:3.3
# gpg: key 18ADD4FF: public key "Benjamin Peterson <benjamin@python.org>" imported
-RUN gpg --keyserver ha.pool.sks-keyservers.net --recv-keys C01E1CAD5EA2C4F0B8E3571504C367C218ADD4FF
+ENV GPG_KEY C01E1CAD5EA2C4F0B8E3571504C367C218ADD4FF
ENV PYTHON_VERSION 2.7.11
# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'"
ENV PYTHON_PIP_VERSION 7.1.2
-RUN set -x \
- && buildDeps=' \
- curl \
- gcc \
- libbz2-dev \
- libc6-dev \
- libncurses-dev \
- libreadline-dev \
- libsqlite3-dev \
- libssl-dev \
- make \
- xz-utils \
- zlib1g-dev \
- ' \
- && apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \
- && mkdir -p /usr/src/python \
+RUN set -ex \
+ && apk add --no-cache --virtual .fetch-deps curl gnupg \
+ && gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPG_KEY" \
&& curl -fSL "https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tar.xz" -o python.tar.xz \
&& curl -fSL "https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tar.xz.asc" -o python.tar.xz.asc \
&& gpg --verify python.tar.xz.asc \
- && tar -xJC /usr/src/python --strip-components=1 -f python.tar.xz \
+ && mkdir -p /usr/src \
+ && tar -xJC /usr/src -f python.tar.xz \
+ && mv "/usr/src/Python-$PYTHON_VERSION" /usr/src/python \
&& rm python.tar.xz* \
+ && rm -r ~/.gnupg \
+ \
+ && apk add --no-cache --virtual .build-deps \
+ bzip2-dev \
+ gcc \
+ libc-dev \
+ linux-headers \
+ make \
+ ncurses-dev \
+ openssl-dev \
+ pax-utils \
+ readline-dev \
+ sqlite-dev \
+ zlib-dev \
&& cd /usr/src/python \
&& ./configure --enable-shared --enable-unicode=ucs4 \
&& make -j$(nproc) \
&& make install \
- && ldconfig \
&& curl -fSL 'https://bootstrap.pypa.io/get-pip.py' | python2 \
&& pip install --no-cache-dir --upgrade pip==$PYTHON_PIP_VERSION \
&& find /usr/local \
\( -type d -a -name test -o -name tests \) \
-o \( -type f -a -name '*.pyc' -o -name '*.pyo' \) \
-exec rm -rf '{}' + \
- && apt-get purge -y --auto-remove $buildDeps \
+ && runDeps="$( \
+ scanelf --needed --nobanner --recursive /usr/local \
+ | awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \
+ | sort -u \
+ | xargs -r apk info --installed \
+ | sort -u \
+ )" \
+ && apk add --virtual .python-rundeps $runDeps \
+ && apk del .fetch-deps \
+ && apk del .build-deps \
&& rm -rf /usr/src/python
-# install "virtualenv", since the vast majority of users of this image will want it
-RUN pip install --no-cache-dir virtualenv
-
CMD ["python2"] $ diff -u 3.5/alpine/Dockerfile <(curl -fsSL 'https://raw.githubusercontent.com/Soullivaneuh/python/2.7-alpine/2.7/alpine/Dockerfile')
--- 3.5/alpine/Dockerfile 2016-01-11 12:19:24.170132154 -0800
+++ /dev/fd/63 2016-01-12 08:22:23.405829497 -0800
@@ -1,9 +1,9 @@
FROM alpine:3.3
-# gpg: key F73C700D: public key "Larry Hastings <larry@hastings.org>" imported
-ENV GPG_KEY 97FC712E4C024BBEA48A61ED3A5CA953F73C700D
+# gpg: key 18ADD4FF: public key "Benjamin Peterson <benjamin@python.org>" imported
+ENV GPG_KEY C01E1CAD5EA2C4F0B8E3571504C367C218ADD4FF
-ENV PYTHON_VERSION 3.5.1
+ENV PYTHON_VERSION 2.7.11
# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'"
ENV PYTHON_PIP_VERSION 7.1.2
@@ -11,14 +11,13 @@
RUN set -ex \
&& apk add --no-cache --virtual .fetch-deps curl gnupg \
&& gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPG_KEY" \
- && curl -fSL "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" -o python.tar.xz \
- && curl -fSL "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc" -o python.tar.xz.asc \
+ && curl -fSL "https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tar.xz" -o python.tar.xz \
+ && curl -fSL "https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tar.xz.asc" -o python.tar.xz.asc \
&& gpg --verify python.tar.xz.asc \
&& mkdir -p /usr/src \
&& tar -xJC /usr/src -f python.tar.xz \
&& mv "/usr/src/Python-$PYTHON_VERSION" /usr/src/python \
&& rm python.tar.xz* \
- && apk del .fetch-deps \
&& rm -r ~/.gnupg \
\
&& apk add --no-cache --virtual .build-deps \
@@ -35,9 +34,10 @@
zlib-dev \
&& cd /usr/src/python \
&& ./configure --enable-shared --enable-unicode=ucs4 \
- && make -j$(getconf _NPROCESSORS_ONLN) \
+ && make -j$(nproc) \
&& make install \
- && pip3 install --no-cache-dir --upgrade --ignore-installed pip==$PYTHON_PIP_VERSION \
+ && curl -fSL 'https://bootstrap.pypa.io/get-pip.py' | python2 \
+ && pip install --no-cache-dir --upgrade pip==$PYTHON_PIP_VERSION \
&& find /usr/local \
\( -type d -a -name test -o -name tests \) \
-o \( -type f -a -name '*.pyc' -o -name '*.pyo' \) \
@@ -50,15 +50,8 @@
| sort -u \
)" \
&& apk add --virtual .python-rundeps $runDeps \
+ && apk del .fetch-deps \
&& apk del .build-deps \
&& rm -rf /usr/src/python
-# make some useful symlinks that are expected to exist
-RUN cd /usr/local/bin \
- && ln -s easy_install-3.5 easy_install \
- && ln -s idle3 idle \
- && ln -s pydoc3 pydoc \
- && ln -s python3 python \
- && ln -s python-config3 python-config
-
-CMD ["python3"]
+CMD ["python2"] |
Hmm yes OK, but what should I do? :-) Is this PR OK for you? |
Glad to hear that! I'm waiting for the merge so. 👍 |
LGTM |
2 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #79.