aws-cdk-lib.aws_lambda.AssetImageCodeProps

interface AssetImageCodeProps

LanguageType name
.NETAmazon.CDK.AWS.Lambda.AssetImageCodeProps
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awslambda#AssetImageCodeProps
Javasoftware.amazon.awscdk.services.lambda.AssetImageCodeProps
Pythonaws_cdk.aws_lambda.AssetImageCodeProps
TypeScript (source)aws-cdk-lib » aws_lambda » AssetImageCodeProps

Properties to initialize a new AssetImage.

Example

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as cdk from 'aws-cdk-lib';
import { aws_ecr_assets as ecr_assets } from 'aws-cdk-lib';
import { aws_lambda as lambda } from 'aws-cdk-lib';

declare const networkMode: ecr_assets.NetworkMode;
declare const platform: ecr_assets.Platform;
const assetImageCodeProps: lambda.AssetImageCodeProps = {
  assetName: 'assetName',
  buildArgs: {
    buildArgsKey: 'buildArgs',
  },
  buildSecrets: {
    buildSecretsKey: 'buildSecrets',
  },
  cacheFrom: [{
    type: 'type',

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

    // the properties below are optional
    params: {
      paramsKey: 'params',
    },
  },
  cmd: ['cmd'],
  entrypoint: ['entrypoint'],
  exclude: ['exclude'],
  extraHash: 'extraHash',
  file: 'file',
  followSymlinks: cdk.SymlinkFollowMode.NEVER,
  ignoreMode: cdk.IgnoreMode.GLOB,
  invalidation: {
    buildArgs: false,
    buildSecrets: false,
    extraHash: false,
    file: false,
    networkMode: false,
    outputs: false,
    platform: false,
    repositoryName: false,
    target: false,
  },
  networkMode: networkMode,
  outputs: ['outputs'],
  platform: platform,
  target: 'target',
  workingDirectory: 'workingDirectory',
};

Properties

NameTypeDescription
assetName?stringUnique identifier of the docker image asset and its potential revisions.
buildArgs?{ [string]: string }Build args to pass to the docker build command.
buildSecrets?{ [string]: string }Build secrets.
cacheFrom?DockerCacheOption[]Cache from options to pass to the docker build command.
cacheTo?DockerCacheOptionCache to options to pass to the docker build command.
cmd?string[]Specify or override the CMD on the specified Docker image or Dockerfile.
entrypoint?string[]Specify or override the ENTRYPOINT on the specified Docker image or Dockerfile.
exclude?string[]File paths matching the patterns will be excluded.
extraHash?stringExtra information to encode into the fingerprint (e.g. build instructions and other inputs).
file?stringPath to the Dockerfile (relative to the directory).
followSymlinks?SymlinkFollowModeA strategy for how to handle symlinks.
ignoreMode?IgnoreModeThe ignore behavior to use for exclude patterns.
invalidation?DockerImageAssetInvalidationOptionsOptions to control which parameters are used to invalidate the asset hash.
networkMode?NetworkModeNetworking mode for the RUN commands during build.
outputs?string[]Outputs to pass to the docker build command.
platform?PlatformPlatform to build for.
target?stringDocker target to build to.
workingDirectory?stringSpecify or override the WORKDIR on the specified Docker image or Dockerfile.

assetName?

Type: string (optional, default: no asset name)

Unique identifier of the docker image asset and its potential revisions.

Required if using AppScopedStagingSynthesizer.


buildArgs?

Type: { [string]: string } (optional, default: no build args are passed)

Build args to pass to the docker build command.

Since Docker build arguments are resolved before deployment, keys and values cannot refer to unresolved tokens (such as lambda.functionArn or queue.queueUrl).


buildSecrets?

Type: { [string]: string } (optional, default: no build secrets)

Build secrets.

Docker BuildKit must be enabled to use build secrets.

See also: https://docs.docker.com/build/buildkit/ Example

import { DockerBuildSecret } from 'aws-cdk-lib';

const buildSecrets = {
  'MY_SECRET': DockerBuildSecret.fromSrc('file.txt')
};

cacheFrom?

Type: DockerCacheOption[] (optional, default: no cache from options are passed to the build command)

Cache from options to pass to the docker build command.

See also: https://docs.docker.com/build/cache/backends/


cacheTo?

Type: DockerCacheOption (optional, default: no cache to options are passed to the build command)

Cache to options to pass to the docker build command.

See also: https://docs.docker.com/build/cache/backends/


cmd?

Type: string[] (optional, default: use the CMD specified in the docker image or Dockerfile.)

Specify or override the CMD on the specified Docker image or Dockerfile.

This needs to be in the 'exec form', viz., [ 'executable', 'param1', 'param2' ].

See also: https://docs.docker.com/engine/reference/builder/#cmd


entrypoint?

Type: string[] (optional, default: use the ENTRYPOINT in the docker image or Dockerfile.)

Specify or override the ENTRYPOINT on the specified Docker image or Dockerfile.

An ENTRYPOINT allows you to configure a container that will run as an executable. This needs to be in the 'exec form', viz., [ 'executable', 'param1', 'param2' ].

See also: https://docs.docker.com/engine/reference/builder/#entrypoint


exclude?

Type: string[] (optional, default: nothing is excluded)

File paths matching the patterns will be excluded.

See ignoreMode to set the matching behavior. Has no effect on Assets bundled using the bundling property.


extraHash?

Type: string (optional, default: hash is only based on source content)

Extra information to encode into the fingerprint (e.g. build instructions and other inputs).


file?

Type: string (optional, default: 'Dockerfile')

Path to the Dockerfile (relative to the directory).


followSymlinks?

Type: SymlinkFollowMode (optional, default: SymlinkFollowMode.NEVER)

A strategy for how to handle symlinks.


ignoreMode?

Type: IgnoreMode (optional, default: IgnoreMode.GLOB)

The ignore behavior to use for exclude patterns.


invalidation?

Type: DockerImageAssetInvalidationOptions (optional, default: hash all parameters)

Options to control which parameters are used to invalidate the asset hash.


networkMode?

Type: NetworkMode (optional, default: no networking mode specified (the default networking mode NetworkMode.DEFAULT will be used))

Networking mode for the RUN commands during build.

Support docker API 1.25+.


outputs?

Type: string[] (optional, default: no outputs are passed to the build command (default outputs are used))

Outputs to pass to the docker build command.

See also: https://docs.docker.com/engine/reference/commandline/build/#custom-build-outputs


platform?

Type: Platform (optional, default: no platform specified (the current machine architecture will be used))

Platform to build for.

Requires Docker Buildx.


target?

Type: string (optional, default: no target)

Docker target to build to.


workingDirectory?

Type: string (optional, default: use the WORKDIR in the docker image or Dockerfile.)

Specify or override the WORKDIR on the specified Docker image or Dockerfile.

A WORKDIR allows you to configure the working directory the container will use.

See also: https://docs.docker.com/engine/reference/builder/#workdir