Skip to content
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

alpine variant #23

Open
PeterMartini opened this issue Apr 7, 2016 · 10 comments · May be fixed by #24
Open

alpine variant #23

PeterMartini opened this issue Apr 7, 2016 · 10 comments · May be fixed by #24

Comments

@PeterMartini
Copy link
Member

Like the tin says, an alpine version would be very useful

@ncopa
Copy link

ncopa commented Apr 7, 2016

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 <[email protected]>

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"]

@zakame
Copy link
Member

zakame commented Apr 8, 2016

I'll look into it this weekend 👍

zakame added a commit to zakame/docker-perl that referenced this issue Apr 9, 2016
@zakame
Copy link
Member

zakame commented Apr 9, 2016

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.

@zakame
Copy link
Member

zakame commented Apr 22, 2016

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.

@zakame zakame linked a pull request Apr 22, 2016 that will close this issue
3 tasks
zakame added a commit to zakame/docker-perl that referenced this issue Jul 29, 2017
@zakame
Copy link
Member

zakame commented Jul 30, 2017

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.

@spumer
Copy link

spumer commented May 22, 2018

Any update?

@zakame
Copy link
Member

zakame commented May 23, 2018

@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.

zakame added a commit to zakame/docker-perl that referenced this issue Sep 8, 2020
@zakame
Copy link
Member

zakame commented Sep 8, 2020

Perl 5.32 now seems to build and test fine on Alpine without modification 🎉

I'll do a bit more testing this week and keep some manually-generated Dockerfiles for this for publishing on Hub.

@zakame
Copy link
Member

zakame commented Sep 8, 2020

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

@zakame
Copy link
Member

zakame commented Aug 6, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants