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 ​

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 options are passed to the build command

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

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

directorystringdirectorystrdirectoryStringDirectorystringDirectory*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.

dockerBuildArgs{ [key: string]: string }docker_build_argstyping.Mapping[str, str]dockerBuildArgsMap<String, String>DockerBuildArgsIDictionary<string, string>DockerBuildArgs*map[string]*string#
Additional build arguments.

Default: No additional build arguments

Only allowed when directory is set.

dockerBuildContexts{ [key: string]: string }docker_build_contextstyping.Mapping[str, str]dockerBuildContextsMap<String, String>DockerBuildContextsIDictionary<string, string>DockerBuildContexts*map[string]*string#
Additional build contexts.

Default: No additional build contexts

Only allowed when directory is set.

dockerBuildSecrets{ [key: string]: string }docker_build_secretstyping.Mapping[str, str]dockerBuildSecretsMap<String, String>DockerBuildSecretsIDictionary<string, string>DockerBuildSecrets*map[string]*string#
Additional build secrets.

Default: No additional build secrets

Only allowed when directory is set.

dockerBuildSshstringdocker_build_sshstrdockerBuildSshStringDockerBuildSshstringDockerBuildSsh*string#
SSH agent socket or keys.

Default: No ssh flag is set

Requires building with docker buildkit.

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

Default: The last stage in the Dockerfile

Only allowed when directory is set.

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

Only allowed when directory is set.

dockerOutputsstring[]docker_outputstyping.List[str]dockerOutputsList<String>DockerOutputsstring[]DockerOutputs*[]*string#
Outputs.

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

executablestring[]executabletyping.List[str]executableList<String>Executablestring[]Executable*[]*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

networkModestringnetwork_modestrnetworkModeStringNetworkModestringNetworkMode*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.

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

Default: current machine platform

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