DockerImageCode¶
-
class
aws_cdk.aws_lambda.
DockerImageCode
¶ Bases:
object
Code property for the DockerImageFunction construct.
Static Methods
-
classmethod
from_ecr
(repository, *, cmd=None, entrypoint=None, tag=None)¶ (experimental) Use an existing ECR image as the Lambda code.
- Parameters
repository (
IRepository
) – the ECR repository that the image is in.cmd (
Optional
[List
[str
]]) – Specify or override the CMD on the specified Docker image or Dockerfile. This needs to be in the ‘exec form’, viz.,[ 'executable', 'param1', 'param2' ]
. Default: - use the CMD specified in the docker image or Dockerfile.entrypoint (
Optional
[List
[str
]]) – Specify or override the ENTRYPOINT on the specified Docker image or Dockerfile. An ENTRYPOINT allows you to configure a container that will run as an executable. This needs to be in the ‘exec form’, viz.,[ 'executable', 'param1', 'param2' ]
. Default: - use the ENTRYPOINT in the docker image or Dockerfile.tag (
Optional
[str
]) – The image tag to use when pulling the image from ECR. Default: ‘latest’
- Stability
experimental
- Return type
-
classmethod
from_image_asset
(directory, *, cmd=None, entrypoint=None, build_args=None, file=None, repository_name=None, target=None, extra_hash=None, exclude=None, follow=None, ignore_mode=None)¶ (experimental) Create an ECR image from the specified asset and bind it as the Lambda code.
- Parameters
directory (
str
) – the directory from which the asset must be created.cmd (
Optional
[List
[str
]]) – Specify or override the CMD on the specified Docker image or Dockerfile. This needs to be in the ‘exec form’, viz.,[ 'executable', 'param1', 'param2' ]
. Default: - use the CMD specified in the docker image or Dockerfile.entrypoint (
Optional
[List
[str
]]) – Specify or override the ENTRYPOINT on the specified Docker image or Dockerfile. An ENTRYPOINT allows you to configure a container that will run as an executable. This needs to be in the ‘exec form’, viz.,[ 'executable', 'param1', 'param2' ]
. Default: - use the ENTRYPOINT in the docker image or 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
[List
[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 ‘
- Stability
experimental
- Return type
-
classmethod