Skip to content

alpine variant #23

Description

@PeterMartini

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

Activity

ncopa commented on Apr 7, 2016

@ncopa

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

zakame commented on Apr 8, 2016

@zakame
Member

I'll look into it this weekend 👍

added a commit that references this issue on Apr 9, 2016

zakame commented on Apr 9, 2016

@zakame
Member

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 commented on Apr 22, 2016

@zakame
Member

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.

added a commit that references this issue on Jul 29, 2017

zakame commented on Jul 30, 2017

@zakame
Member

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 commented on May 22, 2018

@spumer

Any update?

zakame commented on May 23, 2018

@zakame
Member

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

added a commit that references this issue on Sep 8, 2020

zakame commented on Sep 8, 2020

@zakame
Member

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 commented on Sep 8, 2020

@zakame
Member

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 commented on Aug 6, 2022

@zakame
Member

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.

zakame commented on Jun 12, 2026

@zakame
Member

PR #24 has been significantly overhauled - I'm targeting to merge it soon during the 5.44 release. Testers welcome! 🙇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions