DockerBuildAssetOptions

class aws_cdk.aws_lambda.DockerBuildAssetOptions(*, build_args=None, cache_disabled=None, cache_from=None, cache_to=None, file=None, platform=None, target_stage=None, image_path=None, output_path=None)

Bases: DockerBuildOptions

Options when creating an asset from a Docker build.

Parameters:
  • build_args (Optional[Mapping[str, str]]) – Build args. Default: - no build args

  • cache_disabled (Optional[bool]) – Disable the cache and pass --no-cache to the docker build command. Default: - cache is used

  • cache_from (Optional[Sequence[Union[DockerCacheOption, Dict[str, Any]]]]) – Cache from options to pass to the docker build command. Default: - no cache from args are passed

  • cache_to (Union[DockerCacheOption, Dict[str, Any], None]) – Cache to options to pass to the docker build command. Default: - no cache to args are passed

  • file (Optional[str]) – Name of the Dockerfile, must relative to the docker build path. Default: Dockerfile

  • platform (Optional[str]) – Set platform if server is multi-platform capable. Requires Docker Engine API v1.38+. Example value: linux/amd64 Default: - no platform specified

  • target_stage (Optional[str]) – Set build target for multi-stage container builds. Any stage defined afterwards will be ignored. Example value: build-env Default: - Build all stages defined in the Dockerfile

  • image_path (Optional[str]) – The path in the Docker image where the asset is located after the build operation. Default: /asset

  • output_path (Optional[str]) – The path on the local filesystem where the asset will be copied using docker cp. Default: - a unique temporary directory in the system temp directory

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_lambda as lambda_

docker_build_asset_options = lambda.DockerBuildAssetOptions(
    build_args={
        "build_args_key": "buildArgs"
    },
    cache_disabled=False,
    cache_from=[DockerCacheOption(
        type="type",

        # the properties below are optional
        params={
            "params_key": "params"
        }
    )],
    cache_to=DockerCacheOption(
        type="type",

        # the properties below are optional
        params={
            "params_key": "params"
        }
    ),
    file="file",
    image_path="imagePath",
    output_path="outputPath",
    platform="platform",
    target_stage="targetStage"
)

Attributes

build_args

Build args.

Default:
  • no build args

cache_disabled

Disable the cache and pass --no-cache to the docker build command.

Default:
  • cache is used

cache_from

Cache from options to pass to the docker build command.

Default:
  • no cache from args are passed

cache_to

Cache to options to pass to the docker build command.

Default:
  • no cache to args are passed

file

Name of the Dockerfile, must relative to the docker build path.

Default:

Dockerfile

image_path

The path in the Docker image where the asset is located after the build operation.

Default:

/asset

output_path

The path on the local filesystem where the asset will be copied using docker cp.

Default:
  • a unique temporary directory in the system temp directory

platform

Set platform if server is multi-platform capable. Requires Docker Engine API v1.38+.

Example value: linux/amd64

Default:
  • no platform specified

target_stage

Set build target for multi-stage container builds. Any stage defined afterwards will be ignored.

Example value: build-env

Default:
  • Build all stages defined in the Dockerfile