Skip to content

nodus.image

View Markdown

The Modal-shaped Image builder (resources.md §5.3).

A chain of immutable builder calls describes an Image spec. Nothing touches the network until the image is used by a published App or .build() is called; the Image object is named by the hash of its spec, so an identical chain reuses the built digest.

class Image(*, base: str | None = None, dockerfile: Obj | None = None, python: str | None = None, steps: tuple[tuple[Any, ...], ...] = , existing: str | None = None, pull_secrets: tuple[str, ...] = ) -> None
add_local_dir(local_path: str | Path, remote_path: str) -> _Image
add_local_file(local_path: str | Path, remote_path: str) -> _Image
add_local_python_source(*modules: str) -> _Image

Copy importable local modules or packages to /workspace/<name>, where the worker imports from.

apt_install(*packages: str) -> _Image
build(*, show_logs: bool = True) -> _Image

Build now (otherwise the first use builds it), streaming the build log; raises ImageBuildFailed.

debian_slim(python_version: str | None = None) -> _Image

The catalog nodus/python:<version> image; defaults to the caller’s Python minor version.

Type: str | None

The built digest, known after .build() or after an App that uses the image was published.

env(values: dict[str, str]) -> _Image
from_dockerfile(path: str | Path, context: str | Path = '.') -> _Image
from_name(name: str) -> _Image

An Image object that already exists in the project.

from_registry(ref: str, secret: Any = None) -> _Image

Start from an OCI reference or a catalog image (nodus/pytorch:2.8-cuda12.8).

Type: str | None

pip_install(*packages: str, index_url: str | None = None, extra_index_urls: list[str] | None = None) -> _Image

Type: str | None

run_commands(*commands: str) -> _Image
uv_pip_install(*packages: str, index_url: str | None = None, extra_index_urls: list[str] | None = None) -> _Image
uv_sync(project_dir: str | Path = '.', frozen: bool = True) -> _Image
workdir(path: str) -> _Image