AssetImage¶
-
class
aws_cdk.aws_ecs.
AssetImage
(directory, *, build_args=None, file=None, repository_name=None, target=None, extra_hash=None, exclude=None, follow=None, ignore_mode=None, follow_symlinks=None)¶ Bases:
aws_cdk.aws_ecs.ContainerImage
An image that will be built from a local directory with a Dockerfile.
Constructs a new instance of the AssetImage class.
- Parameters
directory (
str
) – The directory containing the Dockerfile.build_args (
Optional
[Mapping
[str
,str
]]) – (experimental) Build args to pass to thedocker build
command. Since Docker build arguments are resolved before deployment, keys and values cannot refer to unresolved tokens (such aslambda.functionArn
orqueue.queueUrl
). Default: - no build args are passedfile (
Optional
[str
]) – (experimental) Path to the Dockerfile (relative to the directory). Default: ‘Dockerfile’repository_name (
Optional
[str
]) – (deprecated) ECR repository name. Specify this property if you need to statically address the image, e.g. from a Kubernetes Pod. Note, this is only the repository name, without the registry and the tag parts. Default: - the default ECR repository for CDK assetstarget (
Optional
[str
]) – (experimental) Docker target to build to. Default: - no targetextra_hash (
Optional
[str
]) – (deprecated) Extra information to encode into the fingerprint (e.g. build instructions and other inputs). Default: - hash is only based on source contentexclude (
Optional
[Sequence
[str
]]) – (deprecated) Glob patterns to exclude from the copy. Default: nothing is excludedfollow (
Optional
[FollowMode
]) – (deprecated) A strategy for how to handle symlinks. Default: Neverignore_mode (
Optional
[IgnoreMode
]) – (deprecated) The ignore behavior to use for exclude patterns. Default: - GLOB for file assets, DOCKER or GLOB for docker assets depending on whether the ‘follow_symlinks (
Optional
[SymlinkFollowMode
]) – A strategy for how to handle symlinks. Default: SymlinkFollowMode.NEVER
Methods
-
bind
(scope, container_definition)¶ Called when the image is used by a ContainerDefinition.
- Parameters
scope (
Construct
) –container_definition (
ContainerDefinition
) –
- Return type
Static Methods
-
classmethod
from_asset
(directory, *, build_args=None, file=None, repository_name=None, target=None, extra_hash=None, exclude=None, follow=None, ignore_mode=None, follow_symlinks=None)¶ Reference an image that’s constructed directly from sources on disk.
If you already have a
DockerImageAsset
instance, you can use theContainerImage.fromDockerImageAsset
method instead.- Parameters
directory (
str
) – The directory containing the Dockerfile.build_args (
Optional
[Mapping
[str
,str
]]) – (experimental) Build args to pass to thedocker build
command. Since Docker build arguments are resolved before deployment, keys and values cannot refer to unresolved tokens (such aslambda.functionArn
orqueue.queueUrl
). Default: - no build args are passedfile (
Optional
[str
]) – (experimental) Path to the Dockerfile (relative to the directory). Default: ‘Dockerfile’repository_name (
Optional
[str
]) – (deprecated) ECR repository name. Specify this property if you need to statically address the image, e.g. from a Kubernetes Pod. Note, this is only the repository name, without the registry and the tag parts. Default: - the default ECR repository for CDK assetstarget (
Optional
[str
]) – (experimental) Docker target to build to. Default: - no targetextra_hash (
Optional
[str
]) – (deprecated) Extra information to encode into the fingerprint (e.g. build instructions and other inputs). Default: - hash is only based on source contentexclude (
Optional
[Sequence
[str
]]) – (deprecated) Glob patterns to exclude from the copy. Default: nothing is excludedfollow (
Optional
[FollowMode
]) – (deprecated) A strategy for how to handle symlinks. Default: Neverignore_mode (
Optional
[IgnoreMode
]) – (deprecated) The ignore behavior to use for exclude patterns. Default: - GLOB for file assets, DOCKER or GLOB for docker assets depending on whether the ‘follow_symlinks (
Optional
[SymlinkFollowMode
]) – A strategy for how to handle symlinks. Default: SymlinkFollowMode.NEVER
- Return type
-
classmethod
from_docker_image_asset
(asset)¶ Use an existing
DockerImageAsset
for this container image.- Parameters
asset (
DockerImageAsset
) – TheDockerImageAsset
to use for this container definition.- Return type
-
classmethod
from_ecr_repository
(repository, tag=None)¶ Reference an image in an ECR repository.
- Parameters
repository (
IRepository
) –tag (
Optional
[str
]) –
- Return type
-
classmethod
from_registry
(name, *, credentials=None)¶ Reference an image on DockerHub or another online registry.
- Parameters
name (
str
) –credentials (
Optional
[ISecret
]) – The secret to expose to the container that contains the credentials for the image repository. The supported value is the full ARN of an AWS Secrets Manager secret.
- Return type