AssetImageProps Struct
The properties for building an AssetImage.
Example
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as cdk from 'aws-cdk-lib';
import { aws_ecr_assets as ecr_assets } from 'aws-cdk-lib';
import { aws_ecs as ecs } from 'aws-cdk-lib';
declare const networkMode: ecr_assets.NetworkMode;
declare const platform: ecr_assets.Platform;
const assetImageProps: ecs.AssetImageProps = {
assetName: 'assetName',
buildArgs: {
buildArgsKey: 'buildArgs',
},
buildContexts: {
buildContextsKey: 'buildContexts',
},
buildSecrets: {
buildSecretsKey: 'buildSecrets',
},
buildSsh: 'buildSsh',
cacheDisabled: false,
cacheFrom: [{
type: 'type',
// the properties below are optional
params: {
paramsKey: 'params',
},
}],
cacheTo: {
type: 'type',
// the properties below are optional
params: {
paramsKey: 'params',
},
},
displayName: 'displayName',
exclude: ['exclude'],
extraHash: 'extraHash',
file: 'file',
followSymlinks: cdk.SymlinkFollowMode.NEVER,
ignoreMode: cdk.IgnoreMode.GLOB,
invalidation: {
buildArgs: false,
buildContexts: false,
buildSecrets: false,
buildSsh: false,
extraHash: false,
file: false,
networkMode: false,
outputs: false,
platform: false,
repositoryName: false,
target: false,
},
networkMode: networkMode,
outputs: ['outputs'],
platform: platform,
target: 'target',
};
Properties
Required if using AppScopedStagingSynthesizer.
buildArgs{ [key: string]: string }build_argstyping.Mapping[str, str]buildArgsMap<String, String>BuildArgsIDictionary<string, string>BuildArgs*map[string]*string= no build args are passed#Since Docker build arguments are resolved before deployment, keys and values cannot refer to unresolved tokens (such as lambda.functionArn or queue.queueUrl).
buildContexts{ [key: string]: string }build_contextstyping.Mapping[str, str]buildContextsMap<String, String>BuildContextsIDictionary<string, string>BuildContexts*map[string]*string= no additional build contexts#notes
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).
buildSecrets{ [key: string]: string }build_secretstyping.Mapping[str, str]buildSecretsMap<String, String>BuildSecretsIDictionary<string, string>BuildSecrets*map[string]*string= no build secrets#Docker BuildKit must be enabled to use build secrets.
example
import { DockerBuildSecret } from 'aws-cdk-lib';
const buildSecrets = {
'MY_SECRET': DockerBuildSecret.fromSrc('file.txt')
};
Docker BuildKit must be enabled to use the ssh flag
cacheDisabledbooleancache_disabledboolcacheDisabledBooleanCacheDisabledboolCacheDisabled*bool= cache is used#cacheFromDockerCacheOption[]cache_fromtyping.List[DockerCacheOption]cacheFromList<DockerCacheOption>CacheFromDockerCacheOption[]CacheFrom*[]DockerCacheOption= no cache from options are passed…#default
Default: no cache from options are passed to the build command
cacheToDockerCacheOptioncache_toDockerCacheOptioncacheToDockerCacheOptionCacheToDockerCacheOptionCacheToDockerCacheOption= no cache to options are passed t…#default
Default: no cache to options are passed to the build command
displayNamestringdisplay_namestrdisplayNameStringDisplayNamestringDisplayName*string= Stack-relative construct path#notes
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.
excludestring[]excludetyping.List[str]excludeList<String>Excludestring[]Exclude*[]*string= nothing is excluded#See ignoreMode to set the matching behavior. Has no effect on Assets bundled using the bundling property.
extraHashstringextra_hashstrextraHashStringExtraHashstringExtraHash*string= hash is only based on source con…#default
Default: hash is only based on source content
followSymlinksSymlinkFollowModefollow_symlinksSymlinkFollowModefollowSymlinksSymlinkFollowModeFollowSymlinksSymlinkFollowModeFollowSymlinksSymlinkFollowMode= SymlinkFollowMode.NEVER#ignoreModeIgnoreModeignore_modeIgnoreModeignoreModeIgnoreModeIgnoreModeIgnoreModeIgnoreModeIgnoreMode= IgnoreMode.GLOB#invalidationDockerImageAssetInvalidationOptionsinvalidationDockerImageAssetInvalidationOptionsinvalidationDockerImageAssetInvalidationOptionsInvalidationDockerImageAssetInvalidationOptionsInvalidationDockerImageAssetInvalidationOptions= hash all parameters#networkModeNetworkModenetwork_modeNetworkModenetworkModeNetworkModeNetworkModeNetworkModeNetworkModeNetworkMode= no networking mode specified (th…#Support docker API 1.25+.
default
Default: no networking mode specified (the default networking mode NetworkMode.DEFAULT will be used)
outputsstring[]outputstyping.List[str]outputsList<String>Outputsstring[]Outputs*[]*string= no outputs are passed to the bui…#default
Default: no outputs are passed to the build command (default outputs are used)
platformPlatformplatformPlatformplatformPlatformPlatformPlatformPlatformPlatform= no platform specified (the curre…#Requires Docker Buildx.
default
Default: no platform specified (the current machine architecture will be used)