Skip to content
v2.274.0

DockerCacheOption Struct ​

Options for configuring the Docker cache backend.

Example ​

ts
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 ​

params{ [key: string]: string }paramstyping.Mapping[str, str]paramsMap<String, String>ParamsIDictionary<string, string>Params*map[string]*string#
Any parameters to pass into the docker cache backend configuration.

Default: {} No options provided

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

example
ts
declare const branch: string;

const params = {
  ref: `12345678.dkr.ecr.us-west-2.amazonaws.com/cache:${branch}`,
  mode: "max",
};
typestringtypestrtypeStringTypestringType*string= unspecifiedrequired#
The type of cache to use.

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

example
ts
'registry'