Skip to main content

openhands.runtime.utils.runtime_build

prep_docker_build_folder

def prep_docker_build_folder(dir_path: str,
base_image: str,
skip_init: bool = False,
extra_deps: str | None = None) -> str

Prepares a docker build folder by copying the source code and generating the Dockerfile

Arguments:

  • dir_path (str): The build folder to place the source code and Dockerfile
  • base_image (str): The base Docker image to use for the Dockerfile
  • skip_init (str):
  • extra_deps (str):

Returns:

  • str: The MD5 hash of the build folder directory (dir_path)

get_runtime_image_repo_and_tag

def get_runtime_image_repo_and_tag(base_image: str) -> tuple[str, str]

Retrieves the Docker repo and tag associated with the Docker image.

Arguments:

  • base_image (str): The name of the base Docker image

Returns:

  • tuple[str, str]: The Docker repo and tag of the Docker image

build_runtime_image

def build_runtime_image(base_image: str,
runtime_builder: RuntimeBuilder,
extra_deps: str | None = None,
docker_build_folder: str | None = None,
dry_run: bool = False,
force_rebuild: bool = False) -> str

Prepares the final docker build folder. If dry_run is False, it will also build the OpenHands runtime Docker image using the docker build folder.

Arguments:

  • base_image (str): The name of the base Docker image to use
  • runtime_builder (RuntimeBuilder): The runtime builder to use
  • extra_deps (str):
  • docker_build_folder (str): The directory to use for the build. If not provided a temporary directory will be used
  • dry_run (bool): if True, it will only ready the build folder. It will not actually build the Docker image
  • force_rebuild (bool): if True, it will create the Dockerfile which uses the base_image

Returns:

  • str: <image_repo>:<MD5 hash>. Where MD5 hash is the hash of the docker build folder

See https://docs.all-hands.dev/modules/usage/architecture/runtime for more details.