aws-cdk-lib.DockerBuildOptions

interface DockerBuildOptions

LanguageType name
.NETAmazon.CDK.DockerBuildOptions
Gogithub.com/aws/aws-cdk-go/awscdk/v2#DockerBuildOptions
Javasoftware.amazon.awscdk.DockerBuildOptions
Pythonaws_cdk.DockerBuildOptions
TypeScript (source)aws-cdk-lib » DockerBuildOptions

Docker build options.

Example

new lambda.Function(this, 'Function', {
  code: lambda.Code.fromAsset('/path/to/handler', {
    bundling: {
      image: DockerImage.fromBuild('/path/to/dir/with/DockerFile', {
        buildArgs: {
          ARG1: 'value1',
        },
      }),
      command: ['my', 'cool', 'command'],
    },
  }),
  runtime: lambda.Runtime.PYTHON_3_9,
  handler: 'index.handler',
});

Properties

NameTypeDescription
buildArgs?{ [string]: string }Build args.
file?stringName of the Dockerfile, must relative to the docker build path.
platform?stringSet platform if server is multi-platform capable. Requires Docker Engine API v1.38+.
targetStage?stringSet build target for multi-stage container builds. Any stage defined afterwards will be ignored.

buildArgs?

Type: { [string]: string } (optional, default: no build args)

Build args.


file?

Type: string (optional, default: Dockerfile)

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


platform?

Type: string (optional, default: no platform specified)

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

Example value: linux/amd64


targetStage?

Type: string (optional, default: Build all stages defined in the Dockerfile)

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

Example value: build-env