Giter VIP home page Giter VIP logo

Comments (4)

scottw avatar scottw commented on August 22, 2024

Thanks for this! I've toyed with builder images for alpine-perl for a while but never committed to it because I couldn't find a simple way to keep the images backward compatible (mainly $PATH) with previous images.

I may just need to bite the bullet and make a new tag for it that more or less follows how you've done yours.

from alpine-perl.

pjlsergeant avatar pjlsergeant commented on August 22, 2024

Would adding symlinks from /opt/perl/bin and compiling to explicitly keep the old Perl INC libs in the new Perl's INC lib work to make it backwards compatible?

from alpine-perl.

scottw avatar scottw commented on August 22, 2024

The core problem with compatibility is that the alpine-perl image was designed to allow the consumer to build and install Perl modules (e.g., via cpanm) and thus requires the build-base package which includes gcc and a few other large artifacts. I don't want to break compatibility for people who are wanting a one-stop image for those things.

However, I love the idea of a smaller image. I think after some experimentation (I've got a few on my laptop that are 60MB) I may create a new tag, maybe -slim that does not include these packages. This will require consumers to install build-base and make on their own if they want to install other Perl packages, but for folks who are just mounting their plain Perl app or want to run Perl's REPL, it will be a much smaller image.

from alpine-perl.

pjlsergeant avatar pjlsergeant commented on August 22, 2024

Hey Scott, I don't really understand your point here. So I'm currently using:

https://github.com/pjlsergeant/alpine-perl-mini/blob/master/Dockerfile

as my base file. This image has cpanm installed, and usually the first thing I do is additionally install cpm. Then I can install my deps:

FROM pjlsergeant/alpine-perl-mini AS build
RUN apk add mysql-dev
RUN cpanm DBD::mysql

HOWEVER, because I've installed Perl in /opt/, once I've installed all the deps I want, I can set a build-target that copies over just that, and no longer needs build-essentials and so on:

FROM pjlsergeant/alpine-perl-mini AS prod
# Grab the Perl modules
COPY --from=perlbuild /opt/perl/ /opt/perl/
# Grab any system libraries you needed
RUN apk add mariadb-connector-c
ENV PATH "/opt/perl/bin:$PATH"

And I end up having installed modules I needed with cpanm, but also a tiny image. And if I am actively developing, I can set a build target of build to get the version with cpanm and build-essentials still kicking around.

Specifically the only change I'm asking for here is for Perl itself to be installed in /opt/ so that it (and any modules installed) can be easily imported into a prod container (that ends up being much smaller)

from alpine-perl.

Related Issues (3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.