# BundlingOptions

Bundling options.

- Source: [`core/lib/bundling.ts`](https://github.com/aws/aws-cdk/blob/v2.274.0/packages/aws-cdk-lib/core/lib/bundling.ts#L33)
- Type last changed: v2.88.0 · 20 Jul 2023

## 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

- `bundlingFileAccess`: [BundlingFileAccess](/cdk/api/v2/docs/aws-cdk-lib.BundlingFileAccess.html) = 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`: string[] — The command to run in the Docker container.

  **Default:** run the command defined in the image

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

- `entrypoint`: string[] — The entrypoint to run in the Docker container.

  **Default:** run the entrypoint defined in the image

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

- `environment`: { [key: string]: string } — The environment variables to pass to the Docker container.

  **Default:** no environment variables.

- `image`: [DockerImage](/cdk/api/v2/docs/aws-cdk-lib.DockerImage.html) (required) — The Docker image where the command will run.

- `local`: [ILocalBundling](/cdk/api/v2/docs/aws-cdk-lib.ILocalBundling.html) — 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.

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

  **Default:** no networking options

- `outputType`: [BundlingOutput](/cdk/api/v2/docs/aws-cdk-lib.BundlingOutput.html) = BundlingOutput.AUTO_DISCOVER — The type of output that this bundling operation is producing.

- `platform`: 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.

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

  **Default:** no security options

- `user`: 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

- `volumes`: [DockerVolume](/cdk/api/v2/docs/aws-cdk-lib.DockerVolume.html)[] — Additional Docker volumes to mount.

  **Default:** no additional volumes are mounted

- `volumesFrom`: string[] — Where to mount the specified volumes from.

  **Default:** no containers are specified to mount volumes from

- `workingDirectory`: string = /asset-input — Working directory inside the Docker container.
