Skip to content

Commit 4981110

Browse files
committed
Merge pull request #81 from infosiftr/sync-alpine-better
Adjust alpine and standard variants to be closer in sync
2 parents 6ebb4af + 326d146 commit 4981110

File tree

6 files changed

+30
-15
lines changed

6 files changed

+30
-15
lines changed

2.7/Dockerfile

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,23 @@ RUN apt-get purge -y python.*
88
ENV LANG C.UTF-8
99

1010
# gpg: key 18ADD4FF: public key "Benjamin Peterson <benjamin@python.org>" imported
11-
RUN gpg --keyserver ha.pool.sks-keyservers.net --recv-keys C01E1CAD5EA2C4F0B8E3571504C367C218ADD4FF
11+
ENV GPG_KEY C01E1CAD5EA2C4F0B8E3571504C367C218ADD4FF
1212

1313
ENV PYTHON_VERSION 2.7.11
1414

1515
# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'"
1616
ENV PYTHON_PIP_VERSION 7.1.2
1717

18-
RUN set -x \
19-
&& mkdir -p /usr/src/python \
18+
RUN set -ex \
19+
&& gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPG_KEY" \
2020
&& curl -fSL "https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tar.xz" -o python.tar.xz \
2121
&& curl -fSL "https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tar.xz.asc" -o python.tar.xz.asc \
2222
&& gpg --verify python.tar.xz.asc \
23+
&& mkdir -p /usr/src/python \
2324
&& tar -xJC /usr/src/python --strip-components=1 -f python.tar.xz \
2425
&& rm python.tar.xz* \
26+
&& rm -r ~/.gnupg \
27+
\
2528
&& cd /usr/src/python \
2629
&& ./configure --enable-shared --enable-unicode=ucs4 \
2730
&& make -j$(nproc) \

2.7/alpine/Dockerfile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
FROM alpine:3.3
22

3+
# http://bugs.python.org/issue19846
4+
# > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK.
5+
ENV LANG C.UTF-8
6+
37
# gpg: key 18ADD4FF: public key "Benjamin Peterson <benjamin@python.org>" imported
48
ENV GPG_KEY C01E1CAD5EA2C4F0B8E3571504C367C218ADD4FF
59

@@ -34,7 +38,7 @@ RUN set -ex \
3438
zlib-dev \
3539
&& cd /usr/src/python \
3640
&& ./configure --enable-shared --enable-unicode=ucs4 \
37-
&& make -j$(nproc) \
41+
&& make -j$(getconf _NPROCESSORS_ONLN) \
3842
&& make install \
3943
&& curl -fSL 'https://bootstrap.pypa.io/get-pip.py' | python2 \
4044
&& pip install --no-cache-dir --upgrade pip==$PYTHON_PIP_VERSION \

2.7/slim/Dockerfile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
1414
&& rm -rf /var/lib/apt/lists/*
1515

1616
# gpg: key 18ADD4FF: public key "Benjamin Peterson <benjamin@python.org>" imported
17-
RUN gpg --keyserver ha.pool.sks-keyservers.net --recv-keys C01E1CAD5EA2C4F0B8E3571504C367C218ADD4FF
17+
ENV GPG_KEY C01E1CAD5EA2C4F0B8E3571504C367C218ADD4FF
1818

1919
ENV PYTHON_VERSION 2.7.11
2020

2121
# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'"
2222
ENV PYTHON_PIP_VERSION 7.1.2
2323

24-
RUN set -x \
24+
RUN set -ex \
2525
&& buildDeps=' \
2626
curl \
2727
gcc \
@@ -36,12 +36,15 @@ RUN set -x \
3636
zlib1g-dev \
3737
' \
3838
&& apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \
39-
&& mkdir -p /usr/src/python \
39+
&& gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPG_KEY" \
4040
&& curl -fSL "https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tar.xz" -o python.tar.xz \
4141
&& curl -fSL "https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tar.xz.asc" -o python.tar.xz.asc \
4242
&& gpg --verify python.tar.xz.asc \
43+
&& mkdir -p /usr/src/python \
4344
&& tar -xJC /usr/src/python --strip-components=1 -f python.tar.xz \
4445
&& rm python.tar.xz* \
46+
&& rm -r ~/.gnupg \
47+
\
4548
&& cd /usr/src/python \
4649
&& ./configure --enable-shared --enable-unicode=ucs4 \
4750
&& make -j$(nproc) \
@@ -56,7 +59,4 @@ RUN set -x \
5659
&& apt-get purge -y --auto-remove $buildDeps \
5760
&& rm -rf /usr/src/python
5861

59-
# install "virtualenv", since the vast majority of users of this image will want it
60-
RUN pip install --no-cache-dir virtualenv
61-
6262
CMD ["python2"]

3.5/Dockerfile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,22 @@ RUN apt-get purge -y python.*
88
ENV LANG C.UTF-8
99

1010
# gpg: key F73C700D: public key "Larry Hastings <larry@hastings.org>" imported
11-
RUN gpg --keyserver ha.pool.sks-keyservers.net --recv-keys 97FC712E4C024BBEA48A61ED3A5CA953F73C700D
11+
ENV GPG_KEY 97FC712E4C024BBEA48A61ED3A5CA953F73C700D
1212

1313
ENV PYTHON_VERSION 3.5.1
1414

1515
# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'"
1616
ENV PYTHON_PIP_VERSION 7.1.2
1717

18-
RUN set -x \
18+
RUN set -ex \
19+
&& gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPG_KEY" \
1920
&& curl -fSL "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" -o python.tar.xz \
2021
&& curl -fSL "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc" -o python.tar.xz.asc \
2122
&& gpg --verify python.tar.xz.asc \
2223
&& mkdir -p /usr/src/python \
2324
&& tar -xJC /usr/src/python --strip-components=1 -f python.tar.xz \
2425
&& rm python.tar.xz* \
26+
&& rm -r ~/.gnupg \
2527
\
2628
&& cd /usr/src/python \
2729
&& ./configure --enable-shared --enable-unicode=ucs4 \

3.5/alpine/Dockerfile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
FROM alpine:3.3
22

3+
# http://bugs.python.org/issue19846
4+
# > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK.
5+
ENV LANG C.UTF-8
6+
37
# gpg: key F73C700D: public key "Larry Hastings <larry@hastings.org>" imported
48
ENV GPG_KEY 97FC712E4C024BBEA48A61ED3A5CA953F73C700D
59

@@ -18,8 +22,8 @@ RUN set -ex \
1822
&& tar -xJC /usr/src -f python.tar.xz \
1923
&& mv "/usr/src/Python-$PYTHON_VERSION" /usr/src/python \
2024
&& rm python.tar.xz* \
21-
&& apk del .fetch-deps \
2225
&& rm -r ~/.gnupg \
26+
&& apk del .fetch-deps \
2327
\
2428
&& apk add --no-cache --virtual .build-deps \
2529
bzip2-dev \

3.5/slim/Dockerfile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
1414
&& rm -rf /var/lib/apt/lists/*
1515

1616
# gpg: key F73C700D: public key "Larry Hastings <larry@hastings.org>" imported
17-
RUN gpg --keyserver ha.pool.sks-keyservers.net --recv-keys 97FC712E4C024BBEA48A61ED3A5CA953F73C700D
17+
ENV GPG_KEY 97FC712E4C024BBEA48A61ED3A5CA953F73C700D
1818

1919
ENV PYTHON_VERSION 3.5.1
2020

2121
# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'"
2222
ENV PYTHON_PIP_VERSION 7.1.2
2323

24-
RUN set -x \
24+
RUN set -ex \
2525
&& buildDeps=' \
2626
curl \
2727
gcc \
@@ -36,12 +36,14 @@ RUN set -x \
3636
zlib1g-dev \
3737
' \
3838
&& apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \
39+
&& gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPG_KEY" \
3940
&& curl -fSL "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" -o python.tar.xz \
4041
&& curl -fSL "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc" -o python.tar.xz.asc \
4142
&& gpg --verify python.tar.xz.asc \
4243
&& mkdir -p /usr/src/python \
4344
&& tar -xJC /usr/src/python --strip-components=1 -f python.tar.xz \
4445
&& rm python.tar.xz* \
46+
&& rm -r ~/.gnupg \
4547
\
4648
&& cd /usr/src/python \
4749
&& ./configure --enable-shared --enable-unicode=ucs4 \

0 commit comments

Comments
 (0)