Perl on Miren
Perl isn't auto-detected, so you deploy it with a Dockerfile.miren. This guide uses
Mojolicious, which ships its own production web server — no
separate PSGI wiring needed. The same pattern works for Dancer2 or any PSGI app run
under Plack.
Ask your AI coding agent to "set up this Perl app on Miren" after installing the
Miren agent skills. It adds the Dockerfile.miren, points the server
at 0.0.0.0:$PORT, and deploys — using this page as its reference.
Do you need a Dockerfile?
Yes. Miren doesn't auto-detect Perl, 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. Mojolicious's daemon command takes a
listen URL — use http://*:$PORT to bind all interfaces:
use Mojolicious::Lite -signatures;
get '/' => sub ($c) {
$c->render(text => "Hello from Perl on Miren!\n");
};
app->start;
The Dockerfile
Create Dockerfile.miren in your project root. Install dependencies with cpanm:
FROM perl:5.40
WORKDIR /app
RUN cpanm --notest Mojolicious
COPY . /app
EXPOSE 8080
For an app with a cpanfile, install from it instead: RUN cpanm --notest --installdeps .
.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 that starts the
Mojolicious daemon on the injected port:
web: perl /app/app.pl daemon -l "http://*:$PORT"
Then create .miren/app.toml naming your app and deploy from your project root:
name = "perl-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.
For a PSGI app (Dancer2, Catalyst), run it under a Plack server instead:
web: plackup -s Starman --host 0.0.0.0 --port $PORT app.psgi.
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 MOJO_MODE=production
miren env set -s DATABASE_URL
You can also declare variables in .miren/app.toml:
[[env]]
key = "DATABASE_URL"
value = ""
required = true
sensitive = true
See App Configuration — Environment Variables.
Agent quick reference
- Detection: none — requires
Dockerfile.miren - Base image:
perl:5.40;cpanm --notest Mojolicious(or--installdeps .with acpanfile) - Service is required:
Procfileweb: perl /app/app.pl daemon -l "http://*:$PORT"— the imageCMDis not used - Port: Mojolicious
daemon -l http://*:$PORT; PSGI apps useplackup --host 0.0.0.0 --port $PORT - Env vars:
miren env set -e/-s; read with$ENV{KEY}
Next steps
- Using Dockerfile.miren — how custom builds work
- App Configuration — customize
.miren/app.toml - Deployment — how deploys build and activate