Code Monkey home page Code Monkey logo

alpine-raku's Introduction

Alpine containers for Raku Build Status

A Docker container with Raku using the minimalist Linux distro Alpine.

It includes

  • Raku (Rakudo - NQP - MoarVM), latest version, as well as older versions in tags/subdirectories
  • zef for module installation
  • Linenoise for easy shell use.
  • curl which is needed for some other downstream compatibilities.
  • gcc and musl-dev, which you probably don't need, but can be used for NativeCall-related builds.
  • User raku is defined from version 2020.07, and the Raku process is run as a non-privileged user.

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. Use curl whenever possible.

Working with this container

Use

docker run -it jjmerelo/alpine-raku

to get into the perl6 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 'p6-app'; say 'p6-app'.IO.absolute;"

This will return

/home/raku/p6-app

And then

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

which would return the first 6 Pell numbers. Or

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

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

and then

zef install Math::Constants

Or directly in a single command

docker run -it --rm  --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

Contributions

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

Previous versions

Previous versions of perl6/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.

alpine-raku's People

Contributors

atroxaper avatar jj avatar melezhik avatar nxadm avatar ufobat avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.