Skip to main content

ImageBuildEngine

ImageBuildEngine contains a list of builders that can be used to build an ImageSpec.

Attributes

AttributeTypeDescription
ImageBuilderTypetyping.Literal["local", "remote"]Defines the set of supported image builder backends, restricted to either 'local' or 'remote' execution environments.

Constructor

Signature

def ImageBuildEngine()

Methods


image_exists()

@classmethod
def image_exists(
image: [Image](../../../../image/image.md?sid=flyte__image_image)
) - > Optional[str]

Checks if the specified image already exists in the registry to avoid redundant builds. It evaluates image tags and uses registered image checkers to verify the presence of the manifest.

Parameters

NameTypeDescription
image[Image](../../../../image/image.md?sid=flyte__image_image)The Image object containing metadata like name, registry, and tags to be checked.

Returns

TypeDescription
Optional[str]The URI of the existing image if found, or the original image URI if it is a default image, tagged 'latest', or if existence cannot be verified.

build()

@classmethod
def build(
image: [Image](../../../../image/image.md?sid=flyte__image_image),
builder: ImageBuildEngine.ImageBuilderType | None = None,
dry_run: bool = False,
force: bool = False,
wait: bool = True
) - > [ImageBuild](../../../../build/imagebuild.md?sid=flyte__build_imagebuild)

Build the image. Images to be tagged with latest will always be built. Otherwise, this engine will check the registry to see if the manifest exists.

Parameters

NameTypeDescription
image[Image](../../../../image/image.md?sid=flyte__image_image)The Image specification to be built.
builder`ImageBuildEngine.ImageBuilderTypeNone` = None
dry_runbool = FalseTell the builder to not actually build. Different builders will have different behaviors.
forcebool = FalseSkip the existence check and force a rebuild. When using the remote builder, this also sets overwrite_cache=True on the build run.
waitbool = TrueWait for the build to finish. If wait is False when using the remote image builder, the function will return the build image task URL.

Returns

TypeDescription
[ImageBuild](../../../../build/imagebuild.md?sid=flyte__build_imagebuild)An ImageBuild object with the image URI and remote run (if applicable).