Skip to content

Compose

compose

Defines helpers to modify the Docker Compose template at mirumoji/docker/compose/compose.yaml according to user input

info: Additional Information

- A single annotated template ships in the package
  (`mirumoji/docker/compose/compose.yaml`)

- This module loads it, rewrites the image references and GPU wiring for
  the chosen backend + image source, and writes the resolved file that
  the lifecycle commands run with

RESOLVED_COMPOSE_PATH = HOST_RENDER_DIR / 'compose.resolved.yaml' module-attribute

Defines the path in which to save the edited Docker Compose file

load_template()

Loads the packaged compose template using PyYAML

Returns:

Type Description
dict[str, Any]

The parsed template as a mutable dict

Raises:

Type Description
FileNotFoundError

If the packaged template is missing

transform(template, backend, source)

Edits the template returned by load_template in place according to the chosen transcription backend and image source

Edits Performed
  • Sets both services' image references according to backend and source

  • Adds the NVIDIA GPU reservation + Hugging Face model-cache volume if backend=local

Parameters:

Name Type Description Default
template dict[str, Any]

The parsed packaged compose template

required
backend Backend

The chosen transcription backend

required
source ImageSource

Pull vs local build

required

Returns:

Type Description
dict[str, Any]

The same template dict, now resolved

write_compose(backend, source, *, out_path=RESOLVED_COMPOSE_PATH)

Writes a resolved compose file for the chosen backend + source

Parameters:

Name Type Description Default
backend Backend

The chosen mirumoji transcription backend

required
source ImageSource

Pull vs local build

required
out_path Path

Where to write the resolved file

RESOLVED_COMPOSE_PATH

Returns:

Type Description
Path

The path to the written compose file

Raises:

Type Description
FileNotFoundError

If the packaged template is missing