From d0e8403c8b29ab14af6b6219c53838f2b1f59be1 Mon Sep 17 00:00:00 2001 From: Nicholas Clark Date: Tue, 30 Nov 2021 18:17:54 +0000 Subject: [PATCH] Switch from Star to a minimal install of Rakudo on debian:bullseye-slim This represents several breaking changes at the same time 1) Only install Cro's minimal dependencies. Previously using Rakudo Star meant that we shipped other (useful) modules 2) We now build on bullseye-slim. Star was building on buster, and with more Debian packages installed 3) We now install to /opt/rakudo/bin (etc) The Rakudo Star docker image is build with a prefix of /usr The docker image is still built with a PATH that contains rakudo, zef and the other relevant binaries. --- README.md | 6 ++-- bullseye-rakudo-zef/Dockerfile | 53 ++++++++++++++++++++++++++++++++++ cro-core/Dockerfile | 8 +++-- cro-http-websocket/Dockerfile | 11 ++++--- cro-http/Dockerfile | 14 +++++---- cro/Dockerfile | 11 +++---- 6 files changed, 84 insertions(+), 19 deletions(-) create mode 100644 bullseye-rakudo-zef/Dockerfile diff --git a/README.md b/README.md index 27cd265..4b42246 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # Cro Dockerfiles -These `Dockerfile`s define images that may be used when deploying services -built with [Cro](http://cro.services/). They are based on a recent [Rakudo -Star image](https://hub.docker.com/_/rakudo-star/). +These `Dockerfile`s define images that may be used when deploying services built with [Cro](http://cro.services/). They are based on the Debian `bullseye-slim` image, with build of Rakudo with only Cro's dependencies installed. + +Until Cro version 0.8.7, images were built based on a Rakudo Star image, and hence shipped with many more modules. Beware that if you are upgrading from the Rakudo Star based images, you may well need to change your own `Dockerfile`s to install modules that Star bundled, but are no longer in these images. diff --git a/bullseye-rakudo-zef/Dockerfile b/bullseye-rakudo-zef/Dockerfile new file mode 100644 index 0000000..592123e --- /dev/null +++ b/bullseye-rakudo-zef/Dockerfile @@ -0,0 +1,53 @@ +### Dockerfile for building a minimal rakudo with zef + +# use base image. +FROM debian:bullseye-slim AS build + +# Author +MAINTAINER Nicholas Clark + +ARG rakudo_version=2021.10 +ARG zef_version=v0.13.4 +ARG prefix=/opt/rakudo + +ARG keep="ca-certificates" +ARG build_only="build-essential git" + +# The update-ca-certificates might be cargo-cult. +# Installing ca-certificates is not. + +ENV PATH=${prefix}/share/perl6/site/bin:${prefix}/share/perl6/core/bin:${prefix}/bin:$PATH + +RUN \ + apt-get update && \ + apt-get --yes --no-install-recommends install ${keep} ${build_only} && \ + update-ca-certificates && \ + git config --global advice.detachedHead false && \ + tmpdir="$(mktemp -d)" && \ + cd ${tmpdir} && \ + git clone --depth=1 --shallow-submodules --branch ${rakudo_version} https://github.com/MoarVM/MoarVM && \ + cd MoarVM && \ + ./Configure.pl --prefix=${prefix} && \ + make -j3 install && \ + tmpdir="$(mktemp -d)" && \ + cd ${tmpdir} && \ + git clone --depth=1 --shallow-submodules --branch ${rakudo_version} https://github.com/Raku/nqp && \ + cd nqp && \ + ./Configure.pl --prefix=${prefix} && \ + make -j3 test install && \ + tmpdir="$(mktemp -d)" && \ + cd ${tmpdir} && \ + git clone --depth=1 --shallow-submodules --branch ${rakudo_version} https://github.com/rakudo/rakudo && \ + cd rakudo && \ + ./Configure.pl --prefix=${prefix} && \ + make -j3 test install HARNESS_TYPE=6 && \ + tmpdir="$(mktemp -d)" && \ + cd ${tmpdir} && \ + git clone --depth=1 --branch ${zef_version} https://github.com/ugexe/zef && \ + cd zef && \ + rakudo -I. bin/zef install . && \ + apt-get purge -y --auto-remove ${build_only} && \ + rm -rf /var/lib/apt/lists/* + +# Run when the container launches +CMD ["/opt/rakudo/bin/rakudo"] diff --git a/cro-core/Dockerfile b/cro-core/Dockerfile index 6a4e850..745a099 100644 --- a/cro-core/Dockerfile +++ b/cro-core/Dockerfile @@ -1,6 +1,10 @@ -FROM rakudo-star:2020.01 +FROM bullseye-rakudo-zef:2021-10 MAINTAINER Jonathan Worthington ARG cro_version=0.8.7 -RUN zef install 'Cro::Core:ver<'$cro_version'>' +RUN apt-get update && \ + apt-get --yes --no-install-recommends install curl && \ + zef install 'Cro::Core:ver<'$cro_version'>' && \ + apt-get purge -y --auto-remove curl && \ + rm -rf /var/lib/apt/lists/* diff --git a/cro-http-websocket/Dockerfile b/cro-http-websocket/Dockerfile index 2148d1b..41ec1f7 100644 --- a/cro-http-websocket/Dockerfile +++ b/cro-http-websocket/Dockerfile @@ -1,14 +1,17 @@ -FROM rakudo-star:2020.01 +FROM bullseye-rakudo-zef:2021-10 MAINTAINER Jonathan Worthington ARG cro_version=0.8.7 +ARG keep="libssl-dev" +ARG build_only="build-essential curl git" + RUN apt-get update && \ - apt-get --yes --no-install-recommends install libssl-dev build-essential && \ - zef upgrade OpenSSL && \ + apt-get --yes --no-install-recommends install ${keep} ${build_only} && \ + zef install OpenSSL && \ zef install 'Cro::Core:ver<'$cro_version'>' && \ zef install 'Cro::TLS:ver<'$cro_version'>' && \ zef install 'Cro::HTTP:ver<'$cro_version'>' && \ zef install 'Cro::WebSocket:ver<'$cro_version'>' && \ - apt-get purge -y --auto-remove build-essential && \ + apt-get purge -y --auto-remove ${build_only} && \ rm -rf /var/lib/apt/lists/* diff --git a/cro-http/Dockerfile b/cro-http/Dockerfile index 9800166..f7fcf3a 100644 --- a/cro-http/Dockerfile +++ b/cro-http/Dockerfile @@ -1,12 +1,16 @@ -FROM rakudo-star:2020.01 +FROM bullseye-rakudo-zef:2021-10 MAINTAINER Jonathan Worthington ARG cro_version=0.8.7 +ARG keep="libssl-dev" +ARG build_only="curl git" + RUN apt-get update && \ - apt-get --yes --no-install-recommends install libssl-dev && \ - rm -rf /var/lib/apt/lists/* && \ - zef upgrade OpenSSL && \ + apt-get --yes --no-install-recommends install ${keep} ${build_only} && \ + zef install OpenSSL && \ zef install 'Cro::Core:ver<'$cro_version'>' && \ zef install 'Cro::TLS:ver<'$cro_version'>' && \ - zef install 'Cro::HTTP:ver<'$cro_version'>' + zef install 'Cro::HTTP:ver<'$cro_version'>' && \ + apt-get purge -y --auto-remove ${build_only} && \ + rm -rf /var/lib/apt/lists/* diff --git a/cro/Dockerfile b/cro/Dockerfile index d9aeb92..7018dbc 100644 --- a/cro/Dockerfile +++ b/cro/Dockerfile @@ -1,15 +1,16 @@ -FROM rakudo-star:2020.01 +FROM bullseye-rakudo-zef:2021-10 MAINTAINER Jonathan Worthington -ARG cro_version=0.8.7 +ARG keep="libssl-dev" +ARG build_only="build-essential curl git" RUN apt-get update && \ - apt-get --yes --no-install-recommends install libssl-dev build-essential && \ - zef upgrade OpenSSL && \ + apt-get --yes --no-install-recommends install ${keep} ${build_only} && \ + zef install OpenSSL && \ zef install 'Cro::Core:ver<'$cro_version'>' && \ zef install 'Cro::TLS:ver<'$cro_version'>' && \ zef install 'Cro::HTTP:ver<'$cro_version'>' && \ zef install 'Cro::WebSocket:ver<'$cro_version'>' && \ zef install 'cro:ver<'$cro_version'>' && \ - apt-get purge -y --auto-remove build-essential && \ + apt-get purge -y --auto-remove ${build_only} && \ rm -rf /var/lib/apt/lists/*