GitXplorerGitXplorer
J

alpine-raku

public
24 stars
5 forks
7 issues

Commits

List of commits on branch master.
Unverified
31f50c88d742d2cc275554676a18447d4541a98e

:arrow_up:

JJJ committed a year ago
Unverified
64d2c3c8bb4de63865a15e4027ed703d83529697

:arrow_up:

JJJ committed a year ago
Unverified
c1d129df5f1857723a37f32f1af17fe787880dc9

Container includes coverage closes #28

JJJ committed 2 years ago
Unverified
770bf16d60d4e439be6f995aa7ab9a1c7495f207

:arrow_up:

JJJ committed 2 years ago
Unverified
6ad837b14df2f8f7bbc3cbee0b0e1d2b5ae6275e

:arrow_up:

JJJ committed 2 years ago
Unverified
b5b88d5f69f6a8ef9689061d2f561a2aa140ea7a

Fixes :bug: #28

JJJ committed 2 years ago

README

The README file for this repository.

Alpine containers for Raku Test-create and publish a Docker image

Create and push to GHCR a multiarch image

A Docker container with Raku using the minimalist Linux distro Alpine, essentially the Raku baseline with zef.

It includes

  • Raku (Rakudo - NQP - MoarVM), latest version, as well as older versions in tags/subdirectories as a base image.
  • zef for module installation
  • Linenoise for REPL easiness.
  • User raku is defined from version/tag 2020.07, and the Raku process is run as a non-privileged user. zef is installed for that non-privileged user, it will not work if you use root

New images should be automatically available at Docker hub.

This comes in three flavors:

  • regular
  • gha. Main difference is that the second uses 1001 as UID for the raku user, and then theoretically can be used as a GitHub action runner.
  • multiarch, a multiarch version that includesarv/v7 arm64 and ppc64le.

Working with this container

Use

docker run -it jjmerelo/alpine-raku

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

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

or you can get into the container by running

docker run -it --entrypoint sh -l -c jjmerelo/alpine-raku

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

docker run -v `pwd`:/app -it  jjmerelo/alpine-raku /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

docker run --rm -t jjmerelo/alpine-raku -e "mkdir 'raku-app'; say 'raku-app'.IO.absolute;"

This will return

/home/raku/raku-app

And then

docker run -t -v `pwd`:/home/raku/raku-app jjmerelo/alpine-raku /home/raku/raku-app/pell.p6 6

which would return the first 6 Pell numbers. Or

docker run -t -v `pwd`:/home/raku/raku-app jjmerelo/alpine-raku /home/raku/raku-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 included in the image, you can use it to install new modules. You can do it by getting into the container and running the shell:

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

and then

$ zef install Math::Constants

Or directly in a single command

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

This overrides the default entrypoint and, instead, runs zef as a shell command, installing the module within the container.

More one-liners for demos

Check out the Madhava-Leibniz series that computes the digits of Pi or the binomial coefficients. Run them directly thus:

docker run -t --rm jjmerelo/alpine-raku -e "say π  - 4 * ([+]  <1 -1> <</<<  (1,3,5,7,9...10000))  "

Contributions

Contributions, suggestions and patches are welcome. Please go to the GitHub repo.

Previous versions

Previous versions of raku are available also as image tags. For instance, you can do

docker run -t jjmerelo/alpine-raku:2019.07 -e "'hello þor'.say"

to download and/or run the 2019.07 version of this container.

Additionally, a nightly tag contains a fresh image, built every night from Rakudo HEAD.

See also

The raku-test image can be used directly for tests, no need to build your own based on this one.