Skip to content
v2.274.0

DockerBuildOptions Struct ​

Docker build options.

Example ​

ts
new lambda.Function(this, 'Function', {
  code: lambda.Code.fromAsset('/path/to/handler', {
    bundling: {
      image: DockerImage.fromBuild('/path/to/dir/with/DockerFile', {
        buildArgs: {
          ARG1: 'value1',
        },
      }),
      command: ['my', 'cool', 'command'],
    },
  }),
  runtime: lambda.Runtime.PYTHON_3_9,
  handler: 'index.handler',
});

Properties ​

buildArgs{ [key: string]: string }build_argstyping.Mapping[str, str]buildArgsMap<String, String>BuildArgsIDictionary<string, string>BuildArgs*map[string]*string#
Build args.

Default: no build args

buildContexts{ [key: string]: string }build_contextstyping.Mapping[str, str]buildContextsMap<String, String>BuildContextsIDictionary<string, string>BuildContexts*map[string]*string#
Build contexts to pass to the `docker build` command.

Default: no additional build contexts

Build contexts can be used to specify additional directories or images to use during the build. Each entry specifies a named build context and its source (a directory path, a URL, or a docker image).

cacheDisabledbooleancache_disabledboolcacheDisabledBooleanCacheDisabledboolCacheDisabled*bool#
Disable the cache and pass `--no-cache` to the `docker build` command.

Default: cache is used

cacheFromDockerCacheOption[]cache_fromtyping.List[DockerCacheOption]cacheFromList<DockerCacheOption>CacheFromDockerCacheOption[]CacheFrom*[]DockerCacheOption#
Cache from options to pass to the `docker build` command.

Default: no cache from args are passed

Cache to options to pass to the `docker build` command.

Default: no cache to args are passed

filestringfilestrfileStringFilestringFile*string= `Dockerfile`#
Name of the Dockerfile, must relative to the docker build path.
networkstringnetworkstrnetworkStringNetworkstringNetwork*string#
Docker [Networking options](https://docs.docker.com/reference/cli/docker/buildx/build/#network).

Default: no networking options

platformstringplatformstrplatformStringPlatformstringPlatform*string#
Set platform if server is multi-platform capable. _Requires Docker Engine API v1.38+_.

Default: no platform specified

Example value: linux/amd64

targetStagestringtarget_stagestrtargetStageStringTargetStagestringTargetStage*string#
Set build target for multi-stage container builds. Any stage defined afterwards will be ignored.

Default: Build all stages defined in the Dockerfile

Example value: build-env