A docker container with Perl 6 using the minimalist distro Alpine
Perl 6
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
2018.01
2018.03
2018.04
2018.05
6.c
.gitignore
.travis.yml
ChangeLog
Dockerfile
LICENSE
README.md
_config.yml
heloþor.p6
horadam.p6
pell.p6

README.md

alpine-perl6 Build Status

A Docker container with Perl 6 using the minimalist Linux distro Alpine.

It includes

  • Rakudobrew
  • Perl6, latest version
  • zef for module installation
  • Linenoise for easy shell use.
  • perl, needed to run rakudobrew
  • curl which is needed for some other downstream compatibilities.
  • cpan which is needed to install some Perl5 modules

New images should be automatically available at the Docker hub.

Please note that wget is installed by default in Alpine, but has some known issues. Please use curl whenever possible.

Working with this container

Use

sudo docker run -it jjmerelo/alpine-perl6

to get into the perl6 interpreter REPL. Can also be used as a "binary" this way

sudo docker run -t jjmerelo/alpine-perl6 -e "say 'hello þor'"

or you can get into the container by running

sudo docker run -it --entrypoint sh -l -c jjmerelo/alpine-perl6

You can also run external scripts via the mounted /app volume. After changing to this directory

sudo docker run -v `pwd`:/app -it  jjmerelo/alpine-perl6 /app/heloþor.p6

This heloþor.p6 is the example provided in this repo, which you should have cloned or downloaded in the usual way. Check out the use of þ. Cool, isn't it? You can use any other directory instead of /app

For instance, we can create a directory this way

sudo docker run -t jjmerelo/alpine-perl6 -e "mkdir 'p6-app'; say 'p6-app'.IO.abspath;"

This will return

/root/p6-app

And then

sudo -E  docker run -t -v `pwd`:/root/p6-app jjmerelo/alpine-perl6 /root/p6-app/pell.p6 6

which would return the first 6 Pell numbers. Or

sudo -E  docker run -t -v `pwd`:/root/p6-app jjmerelo/alpine-perl6 /root/p6-app/horadam.p6 10

which will return the 10 first elements of the Horadam sequence for p=0, q=1, r= 0.25, s=0.75.

Install new modules

Since zef is installed, you can use it to install new modules. You can do it by getting into the container and running the shell:

sudo docker run -it --entrypoint="/bin/sh" jjmerelo/alpine-perl6

and then

zef install Math::Constants

Or directly in a single command

sudo docker run -it --rm  --entrypoint=/bin/sh jjmerelo/alpine-perl6 -c "zef install Math::Sequences"

This overrides the default entrypoint and, instead, runs zef as a shell command

More one-liners for demos

Check out the Madhava-Leibniz series that computes the digits of Pi or the binomial coefficients

Contributions

Contributions, suggestions and patches are welcome.

Notes on the last version

This version has been updated to Rakudo Perl 2018.06.