Skip to content

nodus.image

View Markdown

Upload or build container images for Nodus workloads with Image.

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. Image.push instead uploads an already-built local image immediately and returns its digest reference.

class Image(*, base: str | None = None, dockerfile: Obj | None = None, python: str | None = None, steps: tuple[tuple[Any, ...], ...] = , existing: str | None = None, project: 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, project: str | None = None) -> _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, *, project: str | None = None) -> _Image

An Image object in the selected project, or the caller’s project when omitted.

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
push(source: str | Path, *, name: str, project: str | None = None) -> str

Upload a local Docker image or single-image Docker-save archive and return its immutable reference.

Uses the same Nodus login, project authorization and OCI upload as nodus image push. The CLI is included in platform wheels. The result can be passed directly to Sandbox.create(image=...); uploading does not create an Image API object or require an image-pull Secret.

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