~patrickb/RakudoContainerfileBuilder

Script to generate Containerfiles for Rakudo
65f240de — Patrick Böker 3 months ago
Add the LICENSE file
0c86d757 — Patrick Böker 3 months ago
One more cosmetic change in README
4b5d7563 — Patrick Böker 3 months ago
Tune Container example in README some more

refs

main
browse  log 

clone

read-only
https://git.sr.ht/~patrickb/RakudoContainerfileBuilder
read/write
git@git.sr.ht:~patrickb/RakudoContainerfileBuilder

You can also use your local clone with git send-email.

#Rakudo Containerfile Builder

A small script to build Containerfile s that can create Rakudo container images. Currently images are based on Alpine.

The resulting images have approximately the following sizes:

  • rakudo: 71MB
  • rakudo-zef: 280MB (also includes build tools required to install modules with native code)
  • rakudo-perl: 130MB (includes a Perl suitable for use with Inline::Perl5)
  • rakudo-zef-perl: 339MB (includes Zef and Perl)

Containers based on these are recommended to be Multi Stage d and use rakudo-zef in the build stage and a plain alpine (or rakudo-perl should a perl be necessary) in the final stage.

The following example Containerfile showcases that.

# BUILD STAGE #########################
FROM rakudo-zef:2020.12 AS build

RUN mkdir /app
WORKDIR /app

# Install deps separately first to not trash the podman cache on every
# source change.
COPY META6.json .
RUN zef install --deps-only .

# Now copy and compile the actual app.
COPY . .
RUN raku -c -I. service.raku

# FINAL STAGE #########################
FROM alpine:3.13.1

# Copy over app and Raku installation
COPY --from=build /app /app
COPY --from=build /usr/local /usr/local

WORKDIR /app

# Update path to make raku executables available
ENV PATH=$PATH:/usr/local/share/perl6/site/bin

ENV MY_APP_HOST="0.0.0.0" \
    MY_APP_PORT="10000"

EXPOSE 10000
CMD raku -I. service.raku