AssetImage

class aws_cdk.aws_ecs.AssetImage(directory, *, build_args=None, target=None)

Bases: aws_cdk.aws_ecs.ContainerImage

An image that will be built from a local directory with a Dockerfile.

__init__(directory, *, build_args=None, target=None)

Constructs a new instance of the AssetImage class.

Parameters
  • directory (str) – The directory containing the Dockerfile.

  • props

  • build_args (Optional[Mapping[str, str]]) – The arguments to pass to the docker build command. Default: none

  • target (Optional[str]) – Docker target to build to. Default: none

Return type

None

Methods

bind(scope, container_definition)

Called when the image is used by a ContainerDefinition.

Parameters
Return type

ContainerImageConfig

Static Methods

classmethod from_asset(directory, *, build_args=None, target=None)

Reference an image that’s constructed directly from sources on disk.

Parameters
  • directory (str) – The directory containing the Dockerfile.

  • props

  • build_args (Optional[Mapping[str, str]]) – The arguments to pass to the docker build command. Default: none

  • target (Optional[str]) – Docker target to build to. Default: none

Return type

AssetImage

classmethod from_ecr_repository(repository, tag=None)

Reference an image in an ECR repository.

Parameters
Return type

EcrImage

classmethod from_registry(name, *, credentials=None)

Reference an image on DockerHub or another online registry.

Parameters
  • name (str) –

  • props

  • 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

RepositoryImage