# flytekitplugins.envd.image_builder

## Directory

### Classes

| Class | Description |
|-|-|
| [`EnvdImageSpecBuilder`](https://www.union.ai/docs/v1/flyte/api-reference/plugins/envd/flytekitplugins.envd.image_builder/page.md#flytekitpluginsenvdimage_builderenvdimagespecbuilder) | This class is used to build a docker image using envd. |

### Methods

| Method | Description |
|-|-|
| [`create_envd_config()`](#create_envd_config) |  |
| [`envd_context_switch()`](#envd_context_switch) |  |
| [`execute_command()`](#execute_command) |  |

### Variables

| Property | Type | Description |
|-|-|-|
| `FLYTE_ENVD_CONTEXT` | `str` |  |
| `FLYTE_LOCAL_REGISTRY` | `str` |  |
| `REQUIREMENTS_FILE_NAME` | `str` |  |

## Methods

#### create_envd_config()

```python
def create_envd_config(
    image_spec: flytekit.image_spec.image_spec.ImageSpec,
) -> str
```
| Parameter | Type | Description |
|-|-|-|
| `image_spec` | `flytekit.image_spec.image_spec.ImageSpec` | |

#### envd_context_switch()

```python
def envd_context_switch(
    registry: str,
)
```
| Parameter | Type | Description |
|-|-|-|
| `registry` | `str` | |

#### execute_command()

```python
def execute_command(
    command: str,
)
```
| Parameter | Type | Description |
|-|-|-|
| `command` | `str` | |

## flytekitplugins.envd.image_builder.EnvdImageSpecBuilder

This class is used to build a docker image using envd.

### Methods

| Method | Description |
|-|-|
| [`build_image()`](#build_image) | Build the docker image and push it to the registry. |
| [`should_build()`](#should_build) | Whether or not the builder should build the ImageSpec. |

#### build_image()

```python
def build_image(
    image_spec: flytekit.image_spec.image_spec.ImageSpec,
)
```
Build the docker image and push it to the registry.

| Parameter | Type | Description |
|-|-|-|
| `image_spec` | `flytekit.image_spec.image_spec.ImageSpec` | image spec of the task. |

**Returns:** fully_qualified_image_name: Fully qualified image name. If None, then `image_spec.image_name()` is used.

#### should_build()

```python
def should_build(
    image_spec: flytekit.image_spec.image_spec.ImageSpec,
) -> bool
```
Whether or not the builder should build the ImageSpec.

| Parameter | Type | Description |
|-|-|-|
| `image_spec` | `flytekit.image_spec.image_spec.ImageSpec` | image spec of the task. |

**Returns**

True if the image should be built, otherwise it returns False.

**Raises**

| Exception | Description |
|-|-|
| `RuntimeError` | If FLYTE_IMG_FAST_FAIL is set to True and ImageSpec fails to check if the image exists due to a permission issue or other reason. |

---
**Source**: https://github.com/unionai/unionai-docs/blob/main/content/api-reference/plugins/envd/flytekitplugins.envd.image_builder.md
**HTML**: https://www.union.ai/docs/v1/flyte/api-reference/plugins/envd/flytekitplugins.envd.image_builder/
