openhands.runtime.builder.base
RuntimeBuilder Objects
class RuntimeBuilder(abc.ABC)
build
@abc.abstractmethod
def build(path: str, tags: list[str], platform: str | None = None) -> str
Build the runtime image.
Arguments:
path
str - The path to the runtime image's build directory.tags
list[str] - The tags to apply to the runtime image (e.g., ["repo:my-repo", "sha:my-sha"]).platform
str, optional - The target platform for the build. Defaults to None.
Returns:
str
- The name:tag of the runtime image after build (e.g., "repo:sha"). This can be different from the tags input if the builder chooses to mutate the tags (e.g., adding a registry prefix). This should be used for subsequent use (e.g.,docker run
).
Raises:
RuntimeError
- If the build failed.
image_exists
@abc.abstractmethod
def image_exists(image_name: str, pull_from_repo: bool = True) -> bool
Check if the runtime image exists.
Arguments:
image_name
str - The name of the runtime image (e.g., "repo:sha").pull_from_repo
bool - Whether to pull from the remote repo if the image not present locally
Returns:
bool
- Whether the runtime image exists.