BundlingOptions

class aws_cdk.core.BundlingOptions(*, command=None, entrypoint=None, environment=None, image, local=None, output_type=None, security_opt=None, user=None, volumes=None, working_directory=None)

Bases: object

Bundling options.

Parameters
  • command (Optional[Sequence[str]]) – The command to run in the Docker container. Example value: ['npm', 'install'] Default: - run the command defined in the image

  • entrypoint (Optional[Sequence[str]]) – The entrypoint to run in the Docker container. Example value: ['/bin/sh', '-c'] Default: - run the entrypoint defined in the image

  • environment (Optional[Mapping[str, str]]) – The environment variables to pass to the Docker container. Default: - no environment variables.

  • image (DockerImage) – The Docker image where the command will run.

  • local (Optional[ILocalBundling]) – 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. Default: - bundling will only be performed in a Docker container

  • output_type (Optional[BundlingOutput]) – The type of output that this bundling operation is producing. Default: BundlingOutput.AUTO_DISCOVER

  • security_opt (Optional[str]) – Security configuration when running the docker container. Default: - no security options

  • user (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 Windows

  • volumes (Optional[Sequence[DockerVolume]]) – Additional Docker volumes to mount. Default: - no additional volumes are mounted

  • working_directory (Optional[str]) – Working directory inside the Docker container. Default: /asset-input

Example:

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

command

The command to run in the Docker container.

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

Default
  • run the command defined in the image

See

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

Return type

Optional[List[str]]

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

Return type

Optional[List[str]]

environment

The environment variables to pass to the Docker container.

Default
  • no environment variables.

Return type

Optional[Mapping[str, str]]

image

The Docker image where the command will run.

Return type

DockerImage

local

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.

Default
  • bundling will only be performed in a Docker container

Return type

Optional[ILocalBundling]

output_type

The type of output that this bundling operation is producing.

Default

BundlingOutput.AUTO_DISCOVER

Return type

Optional[BundlingOutput]

security_opt

//docs.docker.com/engine/reference/run/#security-configuration>`_ when running the docker container.

Default
  • no security options

Type

`Security configuration <https

Return type

Optional[str]

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

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

Return type

Optional[str]

volumes

Additional Docker volumes to mount.

Default
  • no additional volumes are mounted

Return type

Optional[List[DockerVolume]]

working_directory

Working directory inside the Docker container.

Default

/asset-input

Return type

Optional[str]