DockerBuildOptions
- class aws_cdk.DockerBuildOptions(*, build_args=None, cache_disabled=None, cache_from=None, cache_to=None, file=None, network=None, platform=None, target_stage=None)
Bases:
objectDocker build options.
- Parameters:
build_args (
Optional[Mapping[str,str]]) – Build args. Default: - no build argscache_disabled (
Optional[bool]) – Disable the cache and pass--no-cacheto thedocker buildcommand. Default: - cache is usedcache_from (
Optional[Sequence[Union[DockerCacheOption,Dict[str,Any]]]]) – Cache from options to pass to thedocker buildcommand. Default: - no cache from args are passedcache_to (
Union[DockerCacheOption,Dict[str,Any],None]) – Cache to options to pass to thedocker buildcommand. Default: - no cache to args are passedfile (
Optional[str]) – Name of the Dockerfile, must relative to the docker build path. Default:Dockerfilenetwork (
Optional[str]) – Docker Networking options. Default: - no networking optionsplatform (
Optional[str]) – Set platform if server is multi-platform capable. Requires Docker Engine API v1.38+. Example value:linux/amd64Default: - no platform specifiedtarget_stage (
Optional[str]) – Set build target for multi-stage container builds. Any stage defined afterwards will be ignored. Example value:build-envDefault: - Build all stages defined in the Dockerfile
- ExampleMetadata:
infused
Example:
from aws_cdk import BundlingOptions lambda_.Function(self, "Function", code=lambda_.Code.from_asset("/path/to/handler", bundling=BundlingOptions( image=DockerImage.from_build("/path/to/dir/with/DockerFile", build_args={ "ARG1": "value1" } ), command=["my", "cool", "command"] ) ), runtime=lambda_.Runtime.PYTHON_3_9, handler="index.handler" )
Attributes
- build_args
Build args.
- Default:
no build args
- cache_disabled
Disable the cache and pass
--no-cacheto thedocker buildcommand.- Default:
cache is used
- cache_from
Cache from options to pass to the
docker buildcommand.- Default:
no cache from args are passed
- cache_to
Cache to options to pass to the
docker buildcommand.- Default:
no cache to args are passed
- file
Name of the Dockerfile, must relative to the docker build path.
- Default:
Dockerfile
- network
Docker Networking options.
- Default:
no networking options
- 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