Skip to content

Commit 5eaef5a

Browse files
ncopazakame
authored andcommitted
Fix build dependency for alpine variant
By installing `make` together with build deps we avoid downloading the apkindex more than once. We make it stay by adding it as a runtime dep before deleting build deps.
1 parent 887e9c3 commit 5eaef5a

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

alpine/Dockerfile

+9-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ ENV PERL_CPANM_OPT --no-wget
99

1010
RUN set -x \
1111
&& NPROC=$(getconf _NPROCESSORS_ONLN) \
12-
&& apk add --no-cache make \
13-
&& apk add --no-cache --virtual .build-deps curl procps tar build-base \
12+
&& apk add --no-cache --virtual .build-deps curl procps tar build-base make \
1413
&& curl -SL https://cpan.metacpan.org/authors/id/S/SH/SHAY/perl-5.22.1.tar.bz2 -o perl-5.22.1.tar.bz2 \
1514
&& echo '29f9b320b0299577a3e1d02e9e8ef8f26f160332 *perl-5.22.1.tar.bz2' | sha1sum -c - \
1615
&& tar --strip-components=1 -xjf perl-5.22.1.tar.bz2 -C /usr/src/perl \
@@ -27,6 +26,14 @@ RUN set -x \
2726
&& curl -LO https://raw.githubusercontent.com/miyagawa/cpanminus/master/cpanm \
2827
&& chmod +x cpanm \
2928
&& ./cpanm App::cpanminus \
29+
&& runDeps="$( \
30+
scanelf --needed --nobanner --recursive /usr/local \
31+
| awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \
32+
| sort -u \
33+
| xargs -r apk info --installed \
34+
| sort -u \
35+
)" \
36+
&& apk add --virtual .perl-rundeps $runDeps make \
3037
&& apk del .build-deps \
3138
&& rm -fr ./cpanm /root/.cpanm /usr/src/perl /tmp/*
3239

0 commit comments

Comments
 (0)