DockerCacheOption

class aws_cdk.aws_ecr_assets.DockerCacheOption(*, type, params=None)

Bases: object

Options for configuring the Docker cache backend.

Parameters:
ExampleMetadata:

infused

Example:

from aws_cdk.aws_ecr_assets import DockerImageAsset, Platform


asset = DockerImageAsset(self, "MyBuildImage",
    directory=path.join(__dirname, "my-image"),
    cache_from=[ecr_assets.DockerCacheOption(type="registry", params={"ref": "ghcr.io/myorg/myimage:cache"})],
    cache_to=ecr_assets.DockerCacheOption(type="registry", params={"ref": "ghcr.io/myorg/myimage:cache", "mode": "max", "compression": "zstd"})
)

Attributes

params

Any parameters to pass into the docker cache backend configuration.

Refer to https://docs.docker.com/build/cache/backends/ for cache backend configuration.

Default:

{} No options provided

Example:

# branch: str


params = {
    "ref": f"12345678.dkr.ecr.us-west-2.amazonaws.com/cache:{branch}",
    "mode": "max"
}
type

The type of cache to use.

Refer to https://docs.docker.com/build/cache/backends/ for full list of backends.

Default:
  • unspecified

Example:

"registry"