These libraries are experimental. APIs may change without notice. Generated from source with koruc 0.1.7 on 8/19/2026.
Docker
@korulang/docker@0.0.1Docker DSL for Koru - declarative images, typed container lifecycle
docker/index.kz · 8 tors
@korulang/docker - Docker DSL for Koru · 28 more lines
@korulang/docker - Docker DSL for Koru
Declarative image definitions and typed container lifecycle.
Phantom obligations ensure containers are properly stopped.
DECLARATIVE IMAGES:
~koru/docker:image(tag: "myapp:latest") {
FROM alpine:3.18
COPY zig-out/bin/main /usr/local/bin/myapp
CMD ["myapp"]
}
CONDITIONAL IMAGES (build flags):
~[build("prod")]koru/docker:image(tag: "myapp:latest") {
FROM alpine:3.18
COPY zig-out/bin/main /usr/local/bin/myapp
CMD ["myapp"]
}
~[build("dev")]koru/docker:image(tag: "myapp:latest") {
FROM alpine:3.18
RUN apk add --no-cache gdb strace
COPY zig-out/bin/main /usr/local/bin/myapp
CMD ["myapp", "--debug"]
}
Then run: koruc main.kz --build=prod docker build
This generates Dockerfiles and builds all declared images matching the flag.
Phantom lifecycles
Derived from the phantom labels in the declarations below — state! issues an
obligation the compiler will chase, !state discharges it, a bare state holds it without moving it. Nothing here is hand-drawn.
Container 1 state running!~[comptime|command] pub tor docker {
program: *const Program,
allocator: __koru_std.mem.Allocator,
argv: []const []const u8
}~[comptime|norun] pub tor image { tag: string, source: Source }build
index.kz:251// Build Operations
~pub tor build { tag: string, context: string }
| built Image
| failed { code: i32, msg: string }// Container Lifecycle (with phantom obligations)
//
// Run a container - creates <running!> obligation that must be discharged
~pub tor run { image: string, name: ?string }
| started Container<running!>
| failed { code: i32, msg: string }// Stop a container - discharges <running!> obligation
~pub tor stop { container: Container<!running> }
| stopped
| failed { code: i32, msg: string }// Kill a container (forceful) - also discharges <running!> obligation
~pub tor kill { container: Container<!running> }
| killed
| failed { code: i32, msg: string }push
index.kz:377// Registry Operations
~pub tor push { image: string }
| pushed
| failed { code: i32, msg: string }pull
index.kz:400~pub tor pull { image: string }
| pulled
| failed { code: i32, msg: string }