Sign inSign up

bogaotory/docker-perl-toolchain

By bogaotory

•Updated over 9 years ago

Image which contains the Perl toolchain (plenv + cpanm + carton)

Image
0

424

bogaotory/docker-perl-toolchain repository overview

Build Status Layer Info Version Info

⁠Building a Docker image with the Perl toolchain

Build a docker image which includes the plenv + cpanm + carton Perl toolchain.

  • plenv⁠ - Perl installation manager
  • cpanm⁠ - CPAN installer
  • carton⁠ - Module dependency manager (like Bundler in Ruby)
⁠Build the image yourself

Choose your Perl version by changing PLENV_VERSION in Dockerfile or overwrite PLENV_VERSION with the -e option

cd docker-perl-toolchain
docker build -t [repositoryname] .
⁠Docker image (Automated Build)

The docker image itself is available on Docker Hub: docker-perl-toolchain image⁠.

⁠Example Usage

Suppose you wish to run a script (corecheck.pl) which prints the CPU information of the host. Then you would have these three files:

  1. cpanfile:
requires "Sys::Info", "0.78";
  1. corecheck.pl:
use Sys::Info;
use Sys::Info::Constants qw( :device_cpu );
my $info = Sys::Info->new;
my $cpu  = $info->device( CPU => %options );

printf "CPU: %s\n", scalar($cpu->identify)  || 'N/A';
printf "CPU speed is %s MHz\n", $cpu->speed || 'N/A';
printf "There are %d CPUs\n"  , $cpu->count || 1;
printf "CPU load: %s\n"       , $cpu->load  || 0;
  1. Dockerfile:
FROM bogaotory/perl-toolchain

ADD cpanfile /build/cpanfile
ADD corecheck.pl /build/corecheck.pl

WORKDIR build

RUN . /etc/profile \
 && carton install # This happens in the WORKDIR, modules are installed in /build/local directory

ENTRYPOINT . /etc/profile \
 && carton exec perl corecheck.pl
⁠References

Here is a list of articles/posts/repos I read in order to make this Dockerfile:

Tag summary

Content type

Image

Digest

Size

224.7 MB

Last updated

over 9 years ago

docker pull bogaotory/docker-perl-toolchain