DockerImageAssetProps

class aws_cdk.aws_ecr_assets.DockerImageAssetProps(*, exclude=None, follow=None, ignore_mode=None, extra_hash=None, follow_symlinks=None, build_args=None, file=None, invalidation=None, network_mode=None, platform=None, repository_name=None, target=None, directory)

Bases: DockerImageAssetOptions

Props for DockerImageAssets.

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

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

  • ignore_mode (Optional[IgnoreMode]) – The ignore behavior to use for exclude patterns. Default: IgnoreMode.GLOB

  • 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

  • follow_symlinks (Optional[SymlinkFollowMode]) – A strategy for how to handle symlinks. Default: SymlinkFollowMode.NEVER

  • 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’

  • invalidation (Union[DockerImageAssetInvalidationOptions, Dict[str, Any], None]) – Options to control which parameters are used to invalidate the asset hash. Default: - hash all parameters

  • network_mode (Optional[NetworkMode]) – Networking 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)

  • platform (Optional[Platform]) – Platform to build for. Requires Docker Buildx. Default: - no platform specified (the current machine architecture will be used)

  • 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 assets

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

  • directory (str) – The 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

ExampleMetadata:

infused

Example:

from aws_cdk.aws_ecr_assets import DockerImageAsset


asset = DockerImageAsset(self, "MyBuildImage",
    directory=path.join(__dirname, "my-image"),
    build_args={
        "HTTP_PROXY": "http://10.20.30.2:1234"
    },
    invalidation=DockerImageAssetInvalidationOptions(
        build_args=False
    )
)

Attributes

build_args

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

directory

The 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

exclude

Glob patterns to exclude from the copy.

Default:
  • nothing is excluded

extra_hash

Extra information to encode into the fingerprint (e.g. build instructions and other inputs).

Default:
  • hash is only based on source content

file

Path to the Dockerfile (relative to the directory).

Default:

‘Dockerfile’

follow

(deprecated) A strategy for how to handle symlinks.

Default:

Never

Deprecated:

use followSymlinks instead

Stability:

deprecated

A strategy for how to handle symlinks.

Default:

SymlinkFollowMode.NEVER

ignore_mode

The ignore behavior to use for exclude patterns.

Default:

IgnoreMode.GLOB

invalidation

Options to control which parameters are used to invalidate the asset hash.

Default:
  • hash all parameters

network_mode

Networking 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)

platform

Platform to build for.

Requires Docker Buildx.

Default:
  • no platform specified (the current machine architecture will be used)

repository_name

(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 assets

Deprecated:

to control the location of docker image assets, please override Stack.addDockerImageAsset. this feature will be removed in future releases.

Stability:

deprecated

target

Docker target to build to.

Default:
  • no target