Skip to content
v2.273.0

DockerBuildAssetOptions Struct ​

Options when creating an asset from a Docker build.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_lambda as lambda } from 'aws-cdk-lib';
const dockerBuildAssetOptions: lambda.DockerBuildAssetOptions = {
  buildArgs: {
    buildArgsKey: 'buildArgs',
  },
  buildContexts: {
    buildContextsKey: 'buildContexts',
  },
  cacheDisabled: false,
  cacheFrom: [{
    type: 'type',

    // the properties below are optional
    params: {
      paramsKey: 'params',
    },
  }],
  cacheTo: {
    type: 'type',

    // the properties below are optional
    params: {
      paramsKey: 'params',
    },
  },
  file: 'file',
  imagePath: 'imagePath',
  network: 'network',
  outputPath: 'outputPath',
  platform: 'platform',
  targetStage: 'targetStage',
};

Properties ​

buildArgs{ [key: string]: string }build_argstyping.Mapping[str, str]buildArgsMap<String, String>BuildArgsIDictionary<string, string>BuildArgs*map[string]*string= no build args#
Build args.
buildContexts{ [key: string]: string }build_contextstyping.Mapping[str, str]buildContextsMap<String, String>BuildContextsIDictionary<string, string>BuildContexts*map[string]*string= no additional build contexts#
Build contexts to pass to the `docker build` command.

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= cache is used#
Disable the cache and pass `--no-cache` to the `docker build` command.
cacheFromDockerCacheOption[]cache_fromtyping.List[DockerCacheOption]cacheFromList<DockerCacheOption>CacheFromDockerCacheOption[]CacheFrom*[]DockerCacheOption= no cache from args are passed#
Cache from options to pass to the `docker build` command.
cacheToDockerCacheOptioncache_toDockerCacheOptioncacheToDockerCacheOptionCacheToDockerCacheOptionCacheToDockerCacheOption= no cache to args are passed#
Cache to options to pass to the `docker build` command.
filestringfilestrfileStringFilestringFile*string= `Dockerfile`#
Name of the Dockerfile, must relative to the docker build path.
imagePathstringimage_pathstrimagePathStringImagePathstringImagePath*string= /asset#
The path in the Docker image where the asset is located after the build operation.
networkstringnetworkstrnetworkStringNetworkstringNetwork*string= no networking options#
Docker [Networking options](https://docs.docker.com/reference/cli/docker/buildx/build/#network).
outputPathstringoutput_pathstroutputPathStringOutputPathstringOutputPath*string= a unique temporary directory in …#
The path on the local filesystem where the asset will be copied using `docker cp`.
default

Default: a unique temporary directory in the system temp directory

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

Example value: linux/amd64

targetStagestringtarget_stagestrtargetStageStringTargetStagestringTargetStage*string= Build all stages defined in the …#
Set build target for multi-stage container builds. Any stage defined afterwards will be ignored.

Example value: build-env

default

Default: Build all stages defined in the Dockerfile