1
1
FROM alpine:3.3
2
2
3
+ # gpg: key F73C700D: public key "Larry Hastings <larry@hastings.org>" imported
4
+ ENV GPG_KEY 97FC712E4C024BBEA48A61ED3A5CA953F73C700D
5
+
3
6
ENV PYTHON_VERSION 3.5.1
4
7
5
8
# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'"
6
9
ENV PYTHON_PIP_VERSION 7.1.2
7
10
8
- # gpg: key F73C700D: public key "Larry Hastings <larry@hastings.org>" imported
9
- ENV GPG_KEY 97FC712E4C024BBEA48A61ED3A5CA953F73C700D
10
-
11
- RUN apk add --no-cache --virtual .fetch-deps curl gnupg \
12
- && gpg --keyserver ha.pool.sks-keyservers.net --recv-keys $GPG_KEY \
11
+ RUN set -ex \
12
+ && apk add --no-cache --virtual .fetch-deps curl gnupg \
13
+ && gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPG_KEY" \
13
14
&& curl -fSL "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" -o python.tar.xz \
14
15
&& curl -fSL "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc" -o python.tar.xz.asc \
15
16
&& gpg --verify python.tar.xz.asc \
16
- && mkdir -p /usr/src/ \
17
+ && mkdir -p /usr/src \
17
18
&& tar -xJC /usr/src -f python.tar.xz \
18
- && mv /usr/src/Python-${ PYTHON_VERSION} /usr/src/python \
19
+ && mv " /usr/src/Python-$PYTHON_VERSION" /usr/src/python \
19
20
&& rm python.tar.xz* \
20
- && apk del .fetch-deps
21
-
22
- RUN apk add --no-cache --virtual .build-deps \
21
+ && apk del .fetch-deps \
22
+ && rm -r ~/.gnupg \
23
+ \
24
+ && apk add --no-cache --virtual .build-deps \
23
25
bzip2-dev \
24
26
gcc \
25
27
libc-dev \
@@ -28,9 +30,9 @@ RUN apk add --no-cache --virtual .build-deps \
28
30
make \
29
31
ncurses-dev \
30
32
openssl-dev \
33
+ pax-utils \
31
34
sqlite-dev \
32
35
zlib-dev \
33
- pax-utils \
34
36
&& cd /usr/src/python \
35
37
&& ./configure --enable-shared --enable-unicode=ucs4 \
36
38
&& make -j$(getconf _NPROCESSORS_ONLN) \
@@ -40,12 +42,16 @@ RUN apk add --no-cache --virtual .build-deps \
40
42
\( -type d -a -name test -o -name tests \) \
41
43
-o \( -type f -a -name '*.pyc' -o -name '*.pyo' \) \
42
44
-exec rm -rf '{}' + \
43
- && rundeps=$(scanelf -R -n --nobanner /usr/local/ \
44
- | awk '{gsub(/,/,"\n ",$2); print $2}' \
45
- | sort -u | sed 's/^/so:/' | while read dep; do \
46
- apk info --installed -q $dep && echo $dep; \
47
- done | sort -u) \
48
- && apk add --virtual .python-rundeps $rundeps \
45
+ && runDeps="$( \
46
+ scanelf --needed --nobanner --recursive /usr/local \
47
+ | awk '{ gsub(/,/, " \n so:", $2); print " so:" $2 }' \
48
+ | sort -u \
49
+ | while read dep; do \
50
+ apk info --installed -q " $dep" && echo " $dep"; \
51
+ done \
52
+ | sort -u \
53
+ )" \
54
+ && apk add --virtual .python-rundeps $runDeps \
49
55
&& apk del .build-deps \
50
56
&& rm -rf /usr/src/python
51
57
0 commit comments