interface DockerBuildOptions
| Language | Type name |
|---|---|
.NET | Amazon.CDK.DockerBuildOptions |
Go | github.com/aws/aws-cdk-go/awscdk/v2#DockerBuildOptions |
Java | software.amazon.awscdk.DockerBuildOptions |
Python | aws_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
| Name | Type | Description |
|---|---|---|
| build | { [string]: string } | Build args. |
| build | { [string]: string } | Build contexts to pass to the docker build command. |
| cache | boolean | Disable the cache and pass --no-cache to the docker build command. |
| cache | Docker[] | Cache from options to pass to the docker build command. |
| cache | Docker | Cache to options to pass to the docker build command. |
| file? | string | Name of the Dockerfile, must relative to the docker build path. |
| network? | string | Docker Networking options. |
| platform? | string | Set platform if server is multi-platform capable. Requires Docker Engine API v1.38+. |
| target | string | Set 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.
buildContexts?
Type:
{ [string]: string }
(optional, default: no additional build contexts)
Build contexts to pass to the docker build command.
Build contexts can be used to specify additional directories or images to use during the build. Each entry specifies a named build context and its source (a directory path, a URL, or a docker image).
See also: https://docs.docker.com/build/building/context/#additional-build-contexts
cacheDisabled?
Type:
boolean
(optional, default: cache is used)
Disable the cache and pass --no-cache to the docker build command.
cacheFrom?
Type:
Docker[]
(optional, default: no cache from args are passed)
Cache from options to pass to the docker build command.
cacheTo?
Type:
Docker
(optional, default: no cache to args are passed)
Cache to options to pass to the docker build command.
file?
Type:
string
(optional, default: Dockerfile)
Name of the Dockerfile, must relative to the docker build path.
network?
Type:
string
(optional, default: no networking options)
Docker Networking options.
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

.NET
Go
Java
Python
TypeScript (