Skip to content
docsv0.17.0

ComposeProjection

Projects service declarations to a docker-compose fragment — `services:` and one entry per service. Deterministic text, two-space indent, trailing newline, no YAML library: the subset compose reads (`image`, `ports`, `environment`, `volumes`, `command`) written by hand so the output is the same bytes for the same declarations. Secrets are never inlined — they come out as `${NAME}` and the operator supplies them; a `configKey` the app holds is inlined, one it lacks becomes `${NAME}` too. Every scalar that YAML could misread (ports like `3000:80`, `:80`, numbers, booleans, `.inf`, a tab, `#`) is single-quoted — env KEYS included, so `NO` and `TRUE` stay strings; multi-line values are block scalars whose indentation indicator is decided by the first non-empty line. Named volumes a service mounts are declared at the top level, as compose requires for the file to be a project and not just a fragment.

ComposeProjection::yaml()

public function yaml(array $services, ?Milpa\Runtime\Config $config): string

The compose fragment for the given services, in the given order.

Parameters

Parameters of yaml()
NameTypeDescription
$serviceslist<ServiceDeclaration>
$config(Config | null)the app's config bag, read for `configKey` values