Skip to content

DockerImageAssetSource

Initializer

import { DockerImageAssetSource } from '@alicloud/ros-cdk-core'
const dockerImageAssetSource: DockerImageAssetSource = { ... }

Properties

Name Type Description
sourceHash string The hash of the contents of the docker build context.
assetName string Unique identifier of the docker image asset and its potential revisions.
directoryName string The directory where the Dockerfile is stored, must be relative to the cloud assembly root.
dockerBuildArgs {[ key: string ]: string} Build args to pass to the docker build command.
dockerBuildSACRets {[ key: string ]: string} Build sACRets to pass to the docker build command.
dockerBuildSsh string SSH agent socket or keys to pass to the docker buildx command.
dockerBuildTarget string Docker target to build to.
dockerCacheDisabled boolean Disable the cache and pass --no-cache to the docker build command.
dockerCacheFrom DockerCacheOption[] Cache from options to pass to the docker build command.
dockerCacheTo DockerCacheOption Cache to options to pass to the docker build command.
dockerFile string Path to the Dockerfile (relative to the directory).
dockerOutputs string[] Outputs to pass to the docker build command.
executable string[] An external command that will produce the packaged asset.
networkMode string Networking mode for the RUN commands during build. Requires Docker Engine API v1.25+.
platform string Platform to build for. Requires Docker Buildx.

sourceHashRequired

public readonly sourceHash: string;
  • Type: string

The hash of the contents of the docker build context.

This hash is used throughout the system to identify this image and avoid duplicate work in case the source did not change.

NOTE: this means that if you wish to update your docker image, you must make a modification to the source (e.g. add some metadata to your Dockerfile).


assetNameOptional

public readonly assetName: string;
  • Type: string
  • Default: no asset name

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

Required if using AppScopedStagingSynthesizer.


directoryNameOptional

public readonly directoryName: string;
  • Type: string
  • Default: Exactly one of directoryName and executable is required

The directory where the Dockerfile is stored, must be relative to the cloud assembly root.


dockerBuildArgsOptional

public readonly dockerBuildArgs: {[ key: string ]: string};
  • Type: {[ key: string ]: string}
  • 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.

Only allowed when directoryName is specified.


dockerBuildSACRetsOptional

public readonly dockerBuildSACRets: {[ key: string ]: string};
  • Type: {[ key: string ]: string}
  • Default: no build sACRets are passed

Build sACRets to pass to the docker build command.

Since Docker build sACRets are resolved before deployment, keys and values cannot refer to unresolved tokens.

Only allowed when directoryName is specified.


dockerBuildSshOptional

public readonly dockerBuildSsh: string;
  • Type: string
  • Default: no ssh arg is passed

SSH agent socket or keys to pass to the docker buildx command.


dockerBuildTargetOptional

public readonly dockerBuildTarget: string;
  • Type: string
  • Default: no target

Docker target to build to.

Only allowed when directoryName is specified.


dockerCacheDisabledOptional

public readonly dockerCacheDisabled: boolean;
  • Type: boolean
  • Default: cache is used

Disable the cache and pass --no-cache to the docker build command.


dockerCacheFromOptional

public readonly dockerCacheFrom: DockerCacheOption[];

Cache from options to pass to the docker build command.


dockerCacheToOptional

public readonly dockerCacheTo: DockerCacheOption;

Cache to options to pass to the docker build command.


dockerFileOptional

public readonly dockerFile: string;
  • Type: string
  • Default: no file

Path to the Dockerfile (relative to the directory).

Only allowed when directoryName is specified.


dockerOutputsOptional

public readonly dockerOutputs: string[];
  • Type: string[]
  • Default: no build args are passed

Outputs to pass to the docker build command.


executableOptional

public readonly executable: string[];
  • Type: string[]
  • Default: Exactly one of directoryName and executable is required

An external command that will produce the packaged asset.

The command should produce the name of a local Docker image on stdout.


networkModeOptional

public readonly networkMode: string;
  • Type: string
  • Default: no networking mode specified

Networking mode for the RUN commands during build. Requires Docker Engine API v1.25+.

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


platformOptional

public readonly platform: string;
  • Type: string
  • Default: no platform specified (the current machine architecture will be used)

Platform to build for. Requires Docker Buildx.

Specify this property to build images on a specific platform.