BundlingOptions
- class aws_cdk.BundlingOptions(*, image, bundling_file_access=None, command=None, entrypoint=None, environment=None, local=None, network=None, output_type=None, platform=None, security_opt=None, user=None, volumes=None, volumes_from=None, working_directory=None)
Bases:
object
Bundling options.
- Parameters:
image (
DockerImage
) – The Docker image where the command will run.bundling_file_access (
Optional
[BundlingFileAccess
]) – The access mechanism used to make source files available to the bundling container and to return the bundling output back to the host. Default: - BundlingFileAccess.BIND_MOUNTcommand (
Optional
[Sequence
[str
]]) – The command to run in the Docker container. Example value:['npm', 'install']
Default: - run the command defined in the imageentrypoint (
Optional
[Sequence
[str
]]) – The entrypoint to run in the Docker container. Example value:['/bin/sh', '-c']
Default: - run the entrypoint defined in the imageenvironment (
Optional
[Mapping
[str
,str
]]) – The environment variables to pass to the Docker container. Default: - no environment variables.local (
Optional
[ILocalBundling
]) – Local bundling provider. The provider implements a methodtryBundle()
which should returntrue
if local bundling was performed. Iffalse
is returned, docker bundling will be done. Default: - bundling will only be performed in a Docker containernetwork (
Optional
[str
]) – Docker Networking options. Default: - no networking optionsoutput_type (
Optional
[BundlingOutput
]) – The type of output that this bundling operation is producing. Default: BundlingOutput.AUTO_DISCOVERplatform (
Optional
[str
]) – Platform to build for. Requires Docker Buildx. Specify this property to build images on a specific platform. Default: - no platform specified (the current machine architecture will be used)security_opt (
Optional
[str
]) – Security configuration when running the docker container. Default: - no security optionsuser (
Optional
[str
]) – The user to use when running the Docker container. user | user:group | uid | uid:gid | user:gid | uid:group Default: - uid:gid of the current user or 1000:1000 on Windowsvolumes (
Optional
[Sequence
[Union
[DockerVolume
,Dict
[str
,Any
]]]]) – Additional Docker volumes to mount. Default: - no additional volumes are mountedvolumes_from (
Optional
[Sequence
[str
]]) – Where to mount the specified volumes from. Default: - no containers are specified to mount volumes fromworking_directory (
Optional
[str
]) – Working directory inside the Docker container. Default: /asset-input
- ExampleMetadata:
infused
Example:
import aws_cdk as cdk asset = Asset(self, "BundledAsset", path="/path/to/asset", bundling=cdk.BundlingOptions( image=cdk.DockerImage.from_registry("alpine"), command=["command-that-produces-an-archive.sh"], output_type=cdk.BundlingOutput.NOT_ARCHIVED ) )
Attributes
- bundling_file_access
The access mechanism used to make source files available to the bundling container and to return the bundling output back to the host.
- Default:
BundlingFileAccess.BIND_MOUNT
- command
The command to run in the Docker container.
Example value:
['npm', 'install']
- Default:
run the command defined in the image
- See:
- entrypoint
The entrypoint to run in the Docker container.
Example value:
['/bin/sh', '-c']
- Default:
run the entrypoint defined in the image
- See:
https://docs.docker.com/engine/reference/builder/#entrypoint
- environment
The environment variables to pass to the Docker container.
- Default:
no environment variables.
- image
The Docker image where the command will run.
- local
Local bundling provider.
The provider implements a method
tryBundle()
which should returntrue
if local bundling was performed. Iffalse
is returned, docker bundling will be done.- Default:
bundling will only be performed in a Docker container
- network
//docs.docker.com/engine/reference/commandline/run/#connect-a-container-to-a-network—network>`_.
- Default:
no networking options
- Type:
Docker `Networking options <https
- output_type
The type of output that this bundling operation is producing.
- Default:
BundlingOutput.AUTO_DISCOVER
- platform
Platform to build for. Requires Docker Buildx.
Specify this property to build images on a specific platform.
- Default:
no platform specified (the current machine architecture will be used)
- security_opt
//docs.docker.com/engine/reference/run/#security-configuration>`_ when running the docker container.
- Default:
no security options
- Type:
`Security configuration <https
- user
The user to use when running the Docker container.
user | user:group | uid | uid:gid | user:gid | uid:group
- Default:
uid:gid of the current user or 1000:1000 on Windows
- See:
- volumes
Additional Docker volumes to mount.
- Default:
no additional volumes are mounted
- volumes_from
Where to mount the specified volumes from.
- Default:
no containers are specified to mount volumes from
- See:
https://docs.docker.com/engine/reference/commandline/run/#mount-volumes-from-container—volumes-from
- working_directory
Working directory inside the Docker container.
- Default:
/asset-input