Raku on Miren
Raku isn't auto-detected, so you deploy it with a Dockerfile.miren. This guide uses
Cro, the standard Raku framework for building HTTP services.
Ask your AI coding agent to "set up this Raku app on Miren" after installing the
Miren agent skills. It adds the Dockerfile.miren, binds the server to
0.0.0.0:$PORT, and deploys — using this page as its reference.
Do you need a Dockerfile?
Yes. Miren doesn't auto-detect Raku, so add a Dockerfile.miren to your project root.
Miren builds from it instead of guessing the stack — see
Using Dockerfile.miren.
Miren auto-detects and builds common stacks (Python, Node, Bun, Go, Ruby, Rust) without a Dockerfile. This language isn't one of them yet — if you'd like first-class support, request it.
Bind to the injected port
Miren injects PORT and routes traffic to it, so read PORT and bind 0.0.0.0. The
final sleep; keeps the process alive after the server starts in the background:
use Cro::HTTP::Server;
use Cro::HTTP::Router;
my $application = route {
get -> {
content 'text/plain', "Hello from Raku on Miren!\n";
}
}
my $port = %*ENV<PORT> // 8080;
my Cro::Service $service = Cro::HTTP::Server.new(
:host('0.0.0.0'), :port(+$port), :$application,
);
$service.start;
say "listening on 0.0.0.0:$port";
sleep;
The Dockerfile
Create Dockerfile.miren in your project root. The rakudo-star image bundles Rakudo
and the zef package manager; Cro's TLS support links against OpenSSL, so install
libssl-dev before zef install:
FROM rakudo-star:latest
RUN apt-get update -y && apt-get install -y libssl-dev && rm -rf /var/lib/apt/lists/*
WORKDIR /app
RUN zef install --/test Cro::HTTP
COPY . /app
EXPOSE 8080
Without libssl-dev, installing Cro::HTTP fails while compiling Cro::TLS with
Cannot locate native library 'libssl.so'. The dev package provides the libssl.so
symlink Cro's native bindings look for.
.dockerignore
.git
Set up the app
Even with a Dockerfile.miren, Miren needs at least one service defined — it
doesn't use the image's CMD as the start command. Add a Procfile:
web: raku /app/app.raku
Then create .miren/app.toml naming your app and deploy from your project root:
name = "raku-bench"
miren deploy
If no service is defined, the build succeeds but the deploy stops with
no services defined: please define at least one service in a Procfile or .miren/app.toml.
Environment variables
Set variables with miren env set — -e for plain values, -s for secrets (masked in
output and logs). Read them with %*ENV<KEY>:
miren env set -e LOG_LEVEL=info
miren env set -s DATABASE_URL
See App Configuration — Environment Variables.
Agent quick reference
- Detection: none — requires
Dockerfile.miren - Base image:
rakudo-star:latest(Rakudo + zef);zef install --/test Cro::HTTP - OpenSSL: install
libssl-devbeforezef installor Cro::TLS fails to build - Service is required: define a
Procfile(web: raku /app/app.raku) — the imageCMDis not used - Keep-alive: end with
sleep;so the process stays up after$service.start - Port:
%*ENV<PORT>;Cro::HTTP::Server.new(:host('0.0.0.0'), :port(...)) - Env vars:
miren env set -e/-s; read with%*ENV<KEY>
Next steps
- Perl on Miren — the Perl guide
- Using Dockerfile.miren — how custom builds work
- Deployment — how deploys build and activate