Skip to content
v2.274.0

DockerImageSource Struct ​

Properties for how to produce a Docker image from a source.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { cloud_assembly_schema } from 'aws-cdk-lib';
const dockerImageSource: cloud_assembly_schema.DockerImageSource = {
  cacheDisabled: false,
  cacheFrom: [{
    type: 'type',

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

    // the properties below are optional
    params: {
      paramsKey: 'params',
    },
  },
  directory: 'directory',
  dockerBuildArgs: {
    dockerBuildArgsKey: 'dockerBuildArgs',
  },
  dockerBuildContexts: {
    dockerBuildContextsKey: 'dockerBuildContexts',
  },
  dockerBuildSecrets: {
    dockerBuildSecretsKey: 'dockerBuildSecrets',
  },
  dockerBuildSsh: 'dockerBuildSsh',
  dockerBuildTarget: 'dockerBuildTarget',
  dockerFile: 'dockerFile',
  dockerOutputs: ['dockerOutputs'],
  executable: ['executable'],
  networkMode: 'networkMode',
  platform: 'platform',
};

Properties ​

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

Default: cache is used

cacheFromoptionalDockerCacheOption[]cache_fromoptionaltyping.List[DockerCacheOption]cacheFromoptionalList<DockerCacheOption>CacheFromoptionalDockerCacheOption[]CacheFromoptional*[]DockerCacheOption#
Cache from options to pass to the `docker build` command.

Default: no cache from options are passed to the build command

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

Default: no cache to options are passed to the build command

directoryoptionalstringdirectoryoptionalstrdirectoryoptionalStringDirectoryoptionalstringDirectoryoptional*string#
The directory containing the Docker image build instructions.

Default: Exactly one of directory and executable is required

This path is relative to the asset manifest location.

dockerBuildArgsoptional{ [key: string]: string }docker_build_argsoptionaltyping.Mapping[str, str]dockerBuildArgsoptionalMap<String, String>DockerBuildArgsoptionalIDictionary<string, string>DockerBuildArgsoptional*map[string]*string#
Additional build arguments.

Default: No additional build arguments

Only allowed when directory is set.

dockerBuildContextsoptional{ [key: string]: string }docker_build_contextsoptionaltyping.Mapping[str, str]dockerBuildContextsoptionalMap<String, String>DockerBuildContextsoptionalIDictionary<string, string>DockerBuildContextsoptional*map[string]*string#
Additional build contexts.

Default: No additional build contexts

Only allowed when directory is set.

dockerBuildSecretsoptional{ [key: string]: string }docker_build_secretsoptionaltyping.Mapping[str, str]dockerBuildSecretsoptionalMap<String, String>DockerBuildSecretsoptionalIDictionary<string, string>DockerBuildSecretsoptional*map[string]*string#
Additional build secrets.

Default: No additional build secrets

Only allowed when directory is set.

dockerBuildSshoptionalstringdocker_build_sshoptionalstrdockerBuildSshoptionalStringDockerBuildSshoptionalstringDockerBuildSshoptional*string#
SSH agent socket or keys.

Default: No ssh flag is set

Requires building with docker buildkit.

dockerBuildTargetoptionalstringdocker_build_targetoptionalstrdockerBuildTargetoptionalStringDockerBuildTargetoptionalstringDockerBuildTargetoptional*string#
Target build stage in a Dockerfile with multiple build stages.

Default: The last stage in the Dockerfile

Only allowed when directory is set.

dockerFileoptionalstringdocker_fileoptionalstrdockerFileoptionalStringDockerFileoptionalstringDockerFileoptional*string= "Dockerfile"#
The name of the file with build instructions.

Only allowed when directory is set.

dockerOutputsoptionalstring[]docker_outputsoptionaltyping.List[str]dockerOutputsoptionalList<String>DockerOutputsoptionalstring[]DockerOutputsoptional*[]*string#
Outputs.

Default: no outputs are passed to the build command (default outputs are used)

executableoptionalstring[]executableoptionaltyping.List[str]executableoptionalList<String>Executableoptionalstring[]Executableoptional*[]*string#
A command-line executable that returns the name of a local Docker image on stdout after being run.

Default: Exactly one of directory and executable is required

networkModeoptionalstringnetwork_modeoptionalstrnetworkModeoptionalStringNetworkModeoptionalstringNetworkModeoptional*string#
Networking mode for the RUN commands during build. _Requires Docker Engine API v1.25+_.

Default: no networking mode specified

Specify this property to build images on a specific networking mode.

platformoptionalstringplatformoptionalstrplatformoptionalStringPlatformoptionalstringPlatformoptional*string#
Platform to build for. _Requires Docker Buildx_.

Default: current machine platform

Specify this property to build images on a specific platform/architecture.