An asset that represents a Docker image. The image will be created in build time and uploaded to an ECR repository.
import { DockerImageAsset } from 'aws-cdk-lib/aws-ecr-assets';Or use the module namespace:
import * as ecr_assets from 'aws-cdk-lib/aws-ecr-assets';
// ecr_assets.DockerImageAssetConfiguration passed to the constructor as DockerImageAssetProps.
directoryRequiredstringThe directory where the Dockerfile is stored. Any directory inside with a name that matches the CDK output folder (cdk.out by default) will be excluded from the asset
DockerImageAssetOptionsassetNameOptionalinherited from DockerImageAssetOptionsstringUnique identifier of the docker image asset and its potential revisions. Required if using AppScopedStagingSynthesizer.
Default: - no asset name
buildArgsOptionalinherited from DockerImageAssetOptions{ [key: string]: string }Build args to pass to the `docker build` command. Since Docker build arguments are resolved before deployment, keys and values cannot refer to unresolved tokens (such as `lambda.functionArn` or `queue.queueUrl`).
Default: - no build args are passed
buildContextsOptionalinherited from DockerImageAssetOptions{ [key: string]: string }Build contexts to pass to the `docker build` command. Build contexts can be used to specify additional directories or images to use during the build. Each entry specifies a named build context and its source (a directory path, a URL, or a docker image). Since Docker build contexts are resolved before deployment, keys and values cannot refer to unresolved tokens (such as `lambda.functionArn` or `queue.queueUrl`).
Default: - no additional build contexts
buildSecretsOptionalinherited from DockerImageAssetOptions{ [key: string]: string }Build secrets. Docker BuildKit must be enabled to use build secrets.
Default: - no build secrets
buildSshOptionalinherited from DockerImageAssetOptionsstringSSH agent socket or keys to pass to the `docker build` command. Docker BuildKit must be enabled to use the ssh flag
Default: - no --ssh flag
cacheDisabledOptionalinherited from DockerImageAssetOptionsbooleanDisable the cache and pass `--no-cache` to the `docker build` command.
Default: - cache is used
cacheFromOptionalinherited from DockerImageAssetOptionsDockerCacheOption[]Cache from options to pass to the `docker build` command.
Default: - no cache from options are passed to the build command
cacheToOptionalinherited from DockerImageAssetOptionsDockerCacheOptionCache to options to pass to the `docker build` command.
Default: - no cache to options are passed to the build command
displayNameOptionalinherited from DockerImageAssetOptionsstringA display name for this asset. If supplied, the display name will be used in locations where the asset identifier is printed, like in the CLI progress information. If the same asset is added multiple times, the display name of the first occurrence is used. If `assetName` is given, it will also be used as the default `displayName`. Otherwise, the default is the construct path of the ImageAsset construct, with respect to the enclosing stack. If the asset is produced by a construct helper function (such as `lambda.Code.fromAssetImage()`), this will look like `MyFunction/AssetImage`. We use the stack-relative construct path so that in the common case where you have multiple stacks with the same asset, we won't show something like `/MyBetaStack/MyFunction/Code` when you are actually deploying to production.
Default: - Stack-relative construct path
fileOptionalinherited from DockerImageAssetOptionsstringPath to the Dockerfile (relative to the directory).
Default: 'Dockerfile'
invalidationOptionalinherited from DockerImageAssetOptionsDockerImageAssetInvalidationOptionsOptions to control which parameters are used to invalidate the asset hash.
Default: - hash all parameters
networkModeOptionalinherited from DockerImageAssetOptionsNetworkModeNetworking mode for the RUN commands during build. Support docker API 1.25+.
Default: - no networking mode specified (the default networking mode `NetworkMode.DEFAULT` will be used)
outputsOptionalinherited from DockerImageAssetOptionsstring[]Outputs to pass to the `docker build` command.
Default: - no outputs are passed to the build command (default outputs are used)
platformOptionalinherited from DockerImageAssetOptionsPlatformPlatform to build for. _Requires Docker Buildx_.
Default: - no platform specified (the current machine architecture will be used)
targetOptionalinherited from DockerImageAssetOptionsstringDocker target to build to.
Default: - no target
FileFingerprintOptionsextraHashOptionalinherited from FileFingerprintOptionsstringExtra information to encode into the fingerprint (e.g. build instructions and other inputs).
Default: - hash is only based on source content
FileCopyOptionsexcludeOptionalinherited from FileCopyOptionsstring[]File paths matching the patterns will be excluded. See `ignoreMode` to set the matching behavior. Has no effect on Assets bundled using the `bundling` property.
Default: - nothing is excluded
followSymlinksOptionalinherited from FileCopyOptionsSymlinkFollowModeA strategy for how to handle symlinks.
Default: SymlinkFollowMode.NEVER
ignoreModeOptionalinherited from FileCopyOptionsIgnoreModeThe ignore behavior to use for `exclude` patterns.
Default: IgnoreMode.GLOB
Our bi-weekly newsletter teaches hands-on AWS fundamentals. No certification fluff - just practical knowledge.
Subscribe to Newsletteraws-ecr-assets