aws-cdk-lib.aws_ecr_assets.DockerCacheOption

interface DockerCacheOption

LanguageType name
.NETAmazon.CDK.AWS.Ecr.Assets.DockerCacheOption
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awsecrassets#DockerCacheOption
Javasoftware.amazon.awscdk.services.ecr.assets.DockerCacheOption
Pythonaws_cdk.aws_ecr_assets.DockerCacheOption
TypeScript (source)aws-cdk-lib » aws_ecr_assets » DockerCacheOption

Options for configuring the Docker cache backend.

Example

import { DockerImageAsset, Platform } from 'aws-cdk-lib/aws-ecr-assets';

const asset = new DockerImageAsset(this, 'MyBuildImage', {
  directory: path.join(__dirname, 'my-image'),
  cacheFrom: [{ type: 'registry', params: { ref: 'ghcr.io/myorg/myimage:cache' }}],
  cacheTo: { type: 'registry', params: { ref: 'ghcr.io/myorg/myimage:cache', mode: 'max', compression: 'zstd' }}
})

Properties

NameTypeDescription
typestringThe type of cache to use.
params?{ [string]: string }Any parameters to pass into the docker cache backend configuration.

type

Type: string

The type of cache to use.

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

'registry'

params?

Type: { [string]: string } (optional, default: {} No options provided)

Any parameters to pass into the docker cache backend configuration.

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

declare const branch: string;

const params = {
  ref: `12345678.dkr.ecr.us-west-2.amazonaws.com/cache:${branch}`,
  mode: "max",
};