aws-cdk-lib.BundlingOptions

interface BundlingOptions

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

Bundling options.

Example

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

NameTypeDescription
imageDockerImageThe Docker image where the command will run.
bundlingFileAccess?BundlingFileAccessThe access mechanism used to make source files available to the bundling container and to return the bundling output back to the host.
command?string[]The command to run in the Docker container.
entrypoint?string[]The entrypoint to run in the Docker container.
environment?{ [string]: string }The environment variables to pass to the Docker container.
local?ILocalBundlingLocal bundling provider.
network?stringDocker Networking options.
outputType?BundlingOutputThe type of output that this bundling operation is producing.
securityOpt?stringSecurity configuration when running the docker container.
user?stringThe user to use when running the Docker container.
volumes?DockerVolume[]Additional Docker volumes to mount.
volumesFrom?string[]Where to mount the specified volumes from.
workingDirectory?stringWorking directory inside the Docker container.

image

Type: DockerImage

The Docker image where the command will run.


bundlingFileAccess?

Type: BundlingFileAccess (optional, default: 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.


command?

Type: string[] (optional, default: run the command defined in the image)

The command to run in the Docker container.

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

See also: https://docs.docker.com/engine/reference/run/


entrypoint?

Type: string[] (optional, default: run the entrypoint defined in the image)

The entrypoint to run in the Docker container.

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

See also: https://docs.docker.com/engine/reference/builder/#entrypoint


environment?

Type: { [string]: string } (optional, default: no environment variables.)

The environment variables to pass to the Docker container.


local?

Type: ILocalBundling (optional, default: bundling will only be performed in a Docker container)

Local bundling provider.

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


network?

Type: string (optional, default: no networking options)

Docker Networking options.


outputType?

Type: BundlingOutput (optional, default: BundlingOutput.AUTO_DISCOVER)

The type of output that this bundling operation is producing.


securityOpt?

Type: string (optional, default: no security options)

Security configuration when running the docker container.


user?

Type: string (optional, default: uid:gid of the current user or 1000:1000 on Windows)

The user to use when running the Docker container.

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

See also: https://docs.docker.com/engine/reference/run/#user


volumes?

Type: DockerVolume[] (optional, default: no additional volumes are mounted)

Additional Docker volumes to mount.


volumesFrom?

Type: string[] (optional, default: no containers are specified to mount volumes from)

Where to mount the specified volumes from.

See also: https://docs.docker.com/engine/reference/commandline/run/#mount-volumes-from-container---volumes-from


workingDirectory?

Type: string (optional, default: /asset-input)

Working directory inside the Docker container.