Last active
November 14, 2020 05:48
-
-
Save michaelfung/34ea1946d0aefc2754efc7585842c2ce to your computer and use it in GitHub Desktop.
perl container builder
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# build a perlbrew enabled image | |
# example: docker build -t perl . | |
FROM debian:buster AS devel | |
MAINTAINER "Michael Fung <hkuser2001@gmail.com>" | |
ARG PERLVER="5.28.3" | |
ENV DEBIAN_FRONTEND noninteractive | |
ENV HOME /root | |
SHELL ["/bin/bash", "-c"] | |
ENV PERLBREW_ROOT /opt/perlbrew | |
COPY 01_nodoc /etc/dpkg/dpkg.cfg.d/01_nodoc | |
RUN apt-get update \ | |
&& apt-get -y install git curl build-essential \ | |
&& apt-get install -y libev4 libev-dev libffi6 libffi-dev \ | |
&& apt-get install -y libzmq5 libzmq3-dev \ | |
&& apt-get install -y openssl libssl1.1 libssl-dev libnss3 libnss3-dev \ | |
&& apt-get install -y zlib1g zlib1g-dev \ | |
&& apt-get -y install perlbrew \ | |
&& \curl -L https://install.perlbrew.pl | bash \ | |
&& apt-get clean && rm -rf /var/lib/apt/lists/* # cleanup to save space | |
RUN source /opt/perlbrew/etc/bashrc \ | |
&& (perlbrew install -j2 --64int perl-${PERLVER} \ | |
|| (cat /opt/perlbrew/build.perl-${PERLVER}.log; exit 1;)) \ | |
&& rm -rf /opt/perlbrew/build/* \ | |
&& rm -rf /opt/perlbrew/dists/* | |
RUN source /opt/perlbrew/etc/bashrc \ | |
&& perlbrew use ${PERLVER} \ | |
&& perlbrew install-cpanm \ | |
&& cpanm Carton \ | |
&& rm -rf ~/.cpanm | |
ENV PATH=/opt/perlbrew/bin:/opt/perlbrew/perls/perl-5.28.3/bin:/usr/sbin:/usr/bin:/sbin:/bin | |
CMD ["/bin/bash"] | |
##### runtime ##### | |
FROM debian:buster AS rt | |
MAINTAINER "Michael Fung <hkuser2001@gmail.com>" | |
ENV DEBIAN_FRONTEND noninteractive | |
ENV HOME /root | |
SHELL ["/bin/bash", "-c"] | |
ENV PERLBREW_ROOT /opt/perlbrew | |
COPY 01_nodoc /etc/dpkg/dpkg.cfg.d/01_nodoc | |
# | |
# install required binary libs | |
# | |
RUN apt-get update \ | |
&& apt-get install -y curl ca-certificates less procps lsof \ | |
&& apt-get install -y libev4 libffi6 \ | |
&& apt-get install -y libzmq5 libzmq3-dev \ | |
&& apt-get install -y openssl libssl1.1 libnss3 \ | |
&& apt-get install -y zlib1g \ | |
&& apt-get clean && rm -rf /var/lib/apt/lists/* # cleanup to save space | |
COPY --from=devel /opt/perlbrew/ /opt/perlbrew/ | |
COPY entrypoint.sh / | |
ENV PATH=/opt/perlbrew/bin:/opt/perlbrew/perls/perl-5.28.3/bin:/usr/sbin:/usr/bin:/sbin:/bin | |
ENTRYPOINT ["/entrypoint.sh"] | |
CMD ["/bin/bash"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment