Skip to content

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

Notifications You must be signed in to change notification settings

bogaotory/docker-perl-toolchain

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 

Repository files navigation

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:

About

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

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published