Skip to content
v2.274.0

BundlingOptions Struct ​

Bundling options.

Example ​

ts
import * as cdk from 'aws-cdk-lib';

const asset = new Asset(this, 'BundledAsset', {
  path: '/path/to/asset',
  bundling: {
    image: cdk.DockerImage.fromRegistry('alpine'),
    command: ['command-that-produces-an-archive.sh'],
    outputType: cdk.BundlingOutput.NOT_ARCHIVED, // Bundling output will be zipped even though it produces a single archive file.
  },
});

Properties ​

bundlingFileAccessoptionalBundlingFileAccessbundling_file_accessoptionalBundlingFileAccessbundlingFileAccessoptionalBundlingFileAccessBundlingFileAccessoptionalBundlingFileAccessBundlingFileAccessoptionalBundlingFileAccess= BundlingFileAccess.BIND_MOUNT#
The access mechanism used to make source files available to the bundling container and to return the bundling output back to the host.
commandoptionalstring[]commandoptionaltyping.List[str]commandoptionalList<String>Commandoptionalstring[]Commandoptional*[]*string#
The command to run in the Docker container.

Default: run the command defined in the image

Example value: ['npm', 'install']

entrypointoptionalstring[]entrypointoptionaltyping.List[str]entrypointoptionalList<String>Entrypointoptionalstring[]Entrypointoptional*[]*string#
The entrypoint to run in the Docker container.

Default: run the entrypoint defined in the image

Example value: ['/bin/sh', '-c']

environmentoptional{ [key: string]: string }environmentoptionaltyping.Mapping[str, str]environmentoptionalMap<String, String>EnvironmentoptionalIDictionary<string, string>Environmentoptional*map[string]*string#
The environment variables to pass to the Docker container.

Default: no environment variables.

The Docker image where the command will run.
localoptionalILocalBundlinglocaloptionalILocalBundlinglocaloptionalILocalBundlingLocaloptionalILocalBundlingLocaloptionalILocalBundling#
Local bundling provider.

Default: bundling will only be performed in a Docker container

The provider implements a method tryBundle() which should return true if local bundling was performed. If false is returned, docker bundling will be done.

networkoptionalstringnetworkoptionalstrnetworkoptionalStringNetworkoptionalstringNetworkoptional*string#
Docker [Networking options](https://docs.docker.com/engine/reference/commandline/run/#connect-a-container-to-a-network---network).

Default: no networking options

outputTypeoptionalBundlingOutputoutput_typeoptionalBundlingOutputoutputTypeoptionalBundlingOutputOutputTypeoptionalBundlingOutputOutputTypeoptionalBundlingOutput= BundlingOutput.AUTO_DISCOVER#
The type of output that this bundling operation is producing.
platformoptionalstringplatformoptionalstrplatformoptionalStringPlatformoptionalstringPlatformoptional*string#
Platform to build for. _Requires Docker Buildx_.

Default: no platform specified (the current machine architecture will be used)

Specify this property to build images on a specific platform.

securityOptoptionalstringsecurity_optoptionalstrsecurityOptoptionalStringSecurityOptoptionalstringSecurityOptoptional*string#
[Security configuration](https://docs.docker.com/engine/reference/run/#security-configuration) when running the docker container.

Default: no security options

useroptionalstringuseroptionalstruseroptionalStringUseroptionalstringUseroptional*string#
The user to use when running the Docker container.

Default: uid:gid of the current user or 1000:1000 on Windows

user | user:group | uid | uid:gid | user:gid | uid:group

volumesoptionalDockerVolume[]volumesoptionaltyping.List[DockerVolume]volumesoptionalList<DockerVolume>VolumesoptionalDockerVolume[]Volumesoptional*[]DockerVolume#
Additional Docker volumes to mount.

Default: no additional volumes are mounted

volumesFromoptionalstring[]volumes_fromoptionaltyping.List[str]volumesFromoptionalList<String>VolumesFromoptionalstring[]VolumesFromoptional*[]*string#
Where to mount the specified volumes from.

Default: no containers are specified to mount volumes from

workingDirectoryoptionalstringworking_directoryoptionalstrworkingDirectoryoptionalStringWorkingDirectoryoptionalstringWorkingDirectoryoptional*string= /asset-input#
Working directory inside the Docker container.