Skip to content

Add alpine variants (templated)#24

Open
zakame wants to merge 8 commits into
Perl:masterfrom
zakame:feature/alpine-variant
Open

Add alpine variants (templated)#24
zakame wants to merge 8 commits into
Perl:masterfrom
zakame:feature/alpine-variant

Conversation

@zakame

@zakame zakame commented Apr 22, 2016

Copy link
Copy Markdown
Member

Resolves #23. This iteration completely re-bases this PR's old work-in-progress on top of current master and shifts approach: alpine variants are now templated through generate.pl instead of hand-edited per Perl version.

What changed

  • Templated, not hand-edited. New Dockerfile.alpine.template (and a sibling Dockerfile.debian.template extracted from the old __DATA__ block). generate.pl dispatches by family.
  • Schema: config.yml debian_releaseos_release: [{family, tag}]. New build_constraints key expresses "no slim on alpine".
  • Two alpine tags per Perl version: alpine3.22 + alpine3.23 (mirroring python:3-alpine / ruby:3-alpine cadence).
  • No setlocale() workaround. Per current state of musl 1.2 + Perl 5.28+, the workaround is unnecessary.
  • Two patches per alpine dir:
  • Build toolchain retained at runtime (parallel to debian-main's buildpack-deps base; diverges from python:3-alpine / ruby:3-alpine which scanelf-prune the compiler). Requires openssl + pkgconf in addition to openssl-dev — confirmed via live build test.
  • tzdata included for DST timezone test coverage (Perl 5.43.9+ ext/POSIX/t/time.t DST transition tests require /usr/share/zoneinfo/).
  • HTTPS regression closed: Net::SSLeay 1.96 + IO::Socket::SSL 2.098 + cpanm 1.7049 + cpm 0.998003 install at build time, matching debian-main parity. Both use --notest since their test suites make live TLS connections that are unreliable in isolated build environments; SSL correctness is verified by the CI "Run HTTPS access test" step.
  • CI: uses existing .github/workflows/build-image.yml auto-discovery (dirname */Dockerfile). The original PR's separate build-alpine.yml is gone. Added fail-fast: false so one variant failure no longer cancels all other jobs. No-lwp test uses sh instead of bash (Alpine only ships busybox sh).
  • library.pl: family-aware; emits both pinned (5.42.2-alpine3.23) and rolling (5.42.2-alpine) tags per the Ruby/Python convention.
  • wget removed from the permanent apk add block — all downloads use curl, saving ~3.4 MiB per image.
  • cpanm wget disabled: cpanm 1.7049 has try_wget=>1 by default; after patching try_lwp=>0, cpanm would fall through to wget before curl. Busybox wget lacks --retry-connrefused (a GNU wget flag cpanm passes unconditionally), causing build failures. Patched with perl -pi -E 's{try_wget=>1}{try_wget=>0}g' so cpanm uses curl directly.
  • sha256sum asymmetry documented: Alpine uses sha256sum -c - (busybox sha256sum lacks --strict); Debian uses sha256sum --strict --check -. Each Dockerfile carries an inline comment explaining the intentional divergence.

Documentation

  • generate.pl POD rewritten: run_tests default corrected to parallel, os_release schema documented (replaces legacy debian_release), build_constraints key explained with example, Alpine Variant Generation section added.
  • library.pl POD added: =head1 FUNCTIONS documents entry() and release() with tag aliasing strategy and EOL compat shim.
  • README updated: temporal phrasing fixed ("From Perl 5.38 onwards"), tzdata and busybox sh caveats added under ### Caveats.

Checklist

  • Build without setlocale() workaround (musl 1.2 + Perl 5.28+ obsoletes it)
  • Retain make plus full build toolchain so cpanm XS installs work
  • Apply for all Perl versions via templating
  • Live build + smoke test: perl 5.042002, Net::SSLeay 1.96, IO::Socket::SSL 2.098, gcc toolchain retained, .build-deps purged
  • All 16 alpine CI jobs green
  • POD documentation for generate.pl and library.pl
  • README caveats for Alpine-specific behaviour

Testing

./test/alpine-checks.sh — static checks run unconditionally; runtime checks gated on RUN_RUNTIME=1:

Static (always):

  • Directory count derived from config.yml (family: alpine entries × 2 threading variants)
  • No slim+alpine combinations (enforces build_constraints)
  • Per-tag balance: each alpine tag derived from config.yml must have the right count individually
  • Each Dockerfile: COPY *.patch, cat *.patch | patch -p1, make test_harness_notty, FROM alpine:N.NN
  • FROM alpine: tag ↔ directory name cross-check
  • -Dusethreads in ./Configure,threaded in directory name
  • tzdata in permanent apk add block
  • CMD perl version matches directory name (zero-pad stripped)
  • cpanm patches present: HTTPS URL rewrite (s{http://), no-LWP (try_lwp=>0), and no-wget (try_wget=>0)
  • Patch files non-empty and contain expected content (256*1024 hunk, busybox-ps skip message)

Runtime (RUN_RUNTIME=1):

  • Permanent toolchain packages retained (build-base, make, openssl-dev, linux-headers, libc-dev, zlib-dev, bzip2-dev, ca-certificates, curl)
  • Transient .build-deps purged — checked per-package so partial retention is caught
  • Compiler reachable (which gcc, which make, pkg-config --exists openssl)
  • POSIX::setlocale does not die; actual locale value printed for CI logs
  • use Net::SSLeay; use IO::Socket::SSL — verifies --notest installs are loadable
  • Threaded variants: threads->create(sub {})->join smoke
  • XS compile against linux-headers: Linux::Inotify2 (sys/inotify.h)

Closes #23.

@zakame zakame force-pushed the feature/alpine-variant branch from 2a416b5 to 5eaef5a Compare July 29, 2017 20:38

@tianon tianon left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Figured I'd leave a few notes on this, both to try to help out and as a subtle bump. 😏 ❤️

Comment thread alpine/Dockerfile Outdated
Comment thread alpine/Dockerfile Outdated
Comment thread alpine/Dockerfile Outdated
Comment thread alpine/Dockerfile Outdated
Comment thread alpine/Dockerfile Outdated
@JJ

JJ commented Dec 3, 2017

Copy link
Copy Markdown

I would also like an Alpine variant, but probably the way to go would be to change everything from the ground up, including Releases.yaml and generate.pl

@J0WI

J0WI commented Nov 16, 2018

Copy link
Copy Markdown
Contributor

try to apply for all Perl versions (maybe via Dockerfile.template)

Replacing generate.pl with an update.sh to integrate @docker-library-bot would be an other improvement.

@zakame

zakame commented Nov 16, 2018

Copy link
Copy Markdown
Member Author

Replacing generate.pl with an update.sh to integrate @docker-library-bot would be an other improvement.

Thanks, could you elaborate further?

I did a cursory check on update.sh from other official-image repos (namely percona, postgres, and php,) and for now I think these bring in some more complexity than I'd care to maintain; I'd be open for PRs for this however.

Another thing to consider is that generate.pl also calls Devel::PatchPerl if needed, so that should be taken into account for the conversion.

@J0WI

J0WI commented Nov 18, 2018

Copy link
Copy Markdown
Contributor

The @docker-library-bot can trigger an update.sh to update Perl and generate Dockerfiles.
Just add it to https://github.com/docker-library/oi-janky-groovy/blob/master/update.sh/vars.groovy and give @docker-library-bot commit access.

@zakame

zakame commented Nov 18, 2018

Copy link
Copy Markdown
Member Author

Yeah, that's what I gathered on reading the update.sh from other images. Might be useful for Perl RC/BLEAD_POINT images, not so much on stable releases (and we already rebuild those anyway on the Hub side when buildpack-deps gets updated.)

Thanks for bringing this up anyway; I might get around to this soon as I'll be getting more involved with Perl RC builds and perhaps this might provide some additional way for managing/bring these up.

@tianon tianon left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Saw some activity so I figured I'd re-review 😅 ❤️

Comment thread alpine/Dockerfile Outdated
Comment thread alpine/Dockerfile Outdated
@zakame zakame changed the title [WIP] Feature/alpine variant Implement :alpine variant Sep 11, 2020
@mohawk2

mohawk2 commented Sep 14, 2020

Copy link
Copy Markdown

This would still be great!

@rabbiveesh

Copy link
Copy Markdown

Is there something this is stalled on? I would love to help if possible

@zakame zakame force-pushed the feature/alpine-variant branch from ace194f to 0cd172f Compare May 15, 2026 16:27
@zakame zakame changed the title Implement :alpine variant Add alpine variants (templated) May 15, 2026
@zakame zakame force-pushed the feature/alpine-variant branch from 0cd172f to 9936de6 Compare May 15, 2026 16:31
@zakame

zakame commented May 15, 2026

Copy link
Copy Markdown
Member Author

Size comparison:

perl:5-bookworm                        487c70ed270b       1.44GB          371MB
perl:5-slim-bookworm                   6c9850944b95        288MB         61.1MB
perl:5.042.002-main-alpine3.23-test    8b9704f40e99        468MB          115MB

Reminder that slim variants don't carry the build toolchain for installing XS CPAN modules by default.

@zakame zakame force-pushed the feature/alpine-variant branch from 420f335 to ca0c2eb Compare May 15, 2026 17:52
@zakame zakame requested a review from tianon May 18, 2026 19:23
@zakame

zakame commented May 18, 2026

Copy link
Copy Markdown
Member Author

I've revisited this now that all tests pass on the stock Perl testsuite - @tianon would appreciate a review! 🙇

@rabbiveesh @mohawk2 feel free to check as well!

zakame added 6 commits June 12, 2026 23:01
…alpine

- Add comment block explaining dirname */Dockerfile matrix auto-discovery
  and slim-gating logic that correctly includes alpine variants.
- fail-fast: false so one variant failure no longer cancels all other jobs.
- cpanm no-lwp test: use sh -c instead of bash -c (Alpine ships busybox sh,
  not bash).
@zakame zakame force-pushed the feature/alpine-variant branch from 073f8dc to d9947a3 Compare June 12, 2026 15:06
@zakame zakame mentioned this pull request Jun 12, 2026
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 this pull request may close these issues.

alpine variant

6 participants