DockerImageAsset

class aws_cdk.aws_ecr_assets.DockerImageAsset(scope, id, *, directory, build_args=None, file=None, repository_name=None, target=None, extra_hash=None, exclude=None, follow=None)

Bases: aws_cdk.core.Construct

An asset that represents a Docker image.

The image will be created in build time and uploaded to an ECR repository.

stability :stability: experimental

__init__(scope, id, *, directory, build_args=None, file=None, repository_name=None, target=None, extra_hash=None, exclude=None, follow=None)
Parameters
  • scope (Construct) –

  • id (str) –

  • directory (str) – The directory where the Dockerfile is stored.

  • build_args (Optional[Mapping[str, str]]) – 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

  • file (Optional[str]) – Path to the Dockerfile (relative to the directory). Default: ‘Dockerfile’

  • repository_name (Optional[str]) – 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 assets

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

  • extra_hash (Optional[str]) – Extra information to encode into the fingerprint (e.g. build instructions and other inputs). Default: - hash is only based on source content

  • exclude (Optional[List[str]]) – Glob patterns to exclude from the copy. Default: nothing is excluded

  • follow (Optional[FollowMode]) – A strategy for how to handle symlinks. Default: Never

stability :stability: experimental

Return type

None

Methods

to_string()

Returns a string representation of this construct.

Return type

str

Attributes

image_uri

The full URI of the image (including a tag).

Use this reference to pull the asset.

stability :stability: experimental

Return type

str

node

The construct tree node associated with this construct.

Return type

ConstructNode

repository

Repository where the image is stored.

stability :stability: experimental

Return type

IRepository

source_hash

A hash of the source of this asset, which is available at construction time.

As this is a plain string, it can be used in construct IDs in order to enforce creation of a new resource when the content hash has changed.

stability :stability: experimental

Return type

str

Static Methods

classmethod is_construct(x)

Return whether the given object is a Construct.

Parameters

x (Any) –

Return type

bool