Open PeterMartini opened 8 years ago
I have an example Dockerfile.
I don't know how to embed it in generate.pl
properly? Maybe we should introduce Dockerfile.template
and Dockerfile.template-alpine
or similar?
There make test_harness
have some failing testcase related non UTF-8 locales.
FROM alpine:latest
MAINTAINER Peter Martini <PeterCMartini@GMail.com>
RUN mkdir -p /usr/src/perl
COPY *.patch /usr/src/perl/
WORKDIR /usr/src/perl
RUN set -x \
&& NPROC=$(getconf _NPROCESSORS_ONLN) \
&& apk add --no-cache --virtual .build-deps \
curl procps tar build-base \
&& curl -SL https://cpan.metacpan.org/authors/id/S/SH/SHAY/perl-5.22.1.tar.bz2 -o perl-5.22.1.tar.bz2 \
&& echo '29f9b320b0299577a3e1d02e9e8ef8f26f160332 *perl-5.22.1.tar.bz2' | sha1sum -c - \
&& tar --strip-components=1 -xjf perl-5.22.1.tar.bz2 -C /usr/src/perl \
&& rm perl-5.22.1.tar.bz2 \
&& cat *.patch | patch -p1 \
&& ./Configure -Duse64bitall -Duseshrplib -des \
&& make -j$NPROC \
&& TEST_JOBS=$NPROC make test_harness \
&& make install \
&& cd /usr/src \
&& curl -LO https://raw.githubusercontent.com/miyagawa/cpanminus/master/cpanm \
&& chmod +x cpanm \
&& ./cpanm App::cpanminus \
&& rm -fr ./cpanm /root/.cpanm /usr/src/perl /tmp/* \
&& apk del .build-deps
WORKDIR /root
CMD ["perl5.22.1","-de0"]
I'll look into it this weekend :+1:
So I tried this evening, and read a bit more about why the failing tests related to locale. Turns out that musl-libc still has some open issues regarding locales:
For my initial alpine build, I've settled on disabling setlocale()
entirely, so I expect some issues; there ought to be another way to solve this.
At the very least, the resulting image size for perl:alpine
(5.22.1) is very promising:
perl alpine 5c08e6b31771 About an hour ago 204.5 MB
perl latest b17836574ef6 5 months ago 656.4 MB
If using @ncopa's example Dockerfile (which deletes the installed .build-deps
after installing cpanm
,) it would be possible to bring down the alpine image to just around 50MB; I'll probably go with that setup later, leaving only curl
and make
so that CPAN installs of pure-Perl modules could work.
Removing build deps:
REPOSITORY TAG IMAGE ID CREATED SIZE
perl alpine d93b2855ed9a About a minute ago 52.61 MB
I retained make
though as a bare minimum so cpanm
can install pure-Perl modules.
Coming back to this again. It seems ok building with 5.22.4, so now I'm testing building against 5.24.2.
There's still some errors for some parts still trying to find setlocale()
, so I'm gonna ask #p5p for help.
Any update?
@spumer thanks for asking. Unfortunately I haven't gotten much feedback from #p5p last time and could not continue further. I doubt that there are specific changes for this on the upcoming 5.28 release as well, but I'll find some time to confirm.
Perl 5.32 now seems to build and test fine on Alpine without modification :tada:
I'll do a bit more testing this week and keep some manually-generated Dockerfiles for this for publishing on Hub.
For anyone who wants to help testing, I've pushed image build for 5.32-alpine and 5.32-alpine-threaded to the hub:
docker pull zakame/perl:5.32-alpine
docker pull zakame/perl:5.32-alpine-threaded
Revisiting this one - I think we could just push out a :alpine
image without issue, as long as we document the obvious issues of glibc vs musl differences.
Like the tin says, an alpine version would be very useful