Skip to content

DockerImageAssetSource

Initializer

import com.aliyun.ros.cdk.core.DockerImageAssetSource;
DockerImageAssetSource.builder()
    .sourceHash(java.lang.String)
//  .assetName(java.lang.String)
//  .directoryName(java.lang.String)
//  .dockerBuildArgs(java.util.Map<java.lang.String, java.lang.String>)
//  .dockerBuildSACRets(java.util.Map<java.lang.String, java.lang.String>)
//  .dockerBuildSsh(java.lang.String)
//  .dockerBuildTarget(java.lang.String)
//  .dockerCacheDisabled(java.lang.Boolean)
//  .dockerCacheFrom(java.util.List<DockerCacheOption>)
//  .dockerCacheTo(DockerCacheOption)
//  .dockerFile(java.lang.String)
//  .dockerOutputs(java.util.List<java.lang.String>)
//  .executable(java.util.List<java.lang.String>)
//  .networkMode(java.lang.String)
//  .platform(java.lang.String)
    .build();

Properties

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

sourceHashRequired

public java.lang.String getSourceHash();
  • Type: java.lang.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 java.lang.String getAssetName();
  • Type: java.lang.String
  • Default: no asset name

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

Required if using AppScopedStagingSynthesizer.


directoryNameOptional

public java.lang.String getDirectoryName();
  • Type: java.lang.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 java.util.Map<java.lang.String, java.lang.String> getDockerBuildArgs();
  • Type: java.util.Map
  • 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 java.util.Map<java.lang.String, java.lang.String> getDockerBuildSACRets();
  • Type: java.util.Map
  • 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 java.lang.String getDockerBuildSsh();
  • Type: java.lang.String
  • Default: no ssh arg is passed

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


dockerBuildTargetOptional

public java.lang.String getDockerBuildTarget();
  • Type: java.lang.String
  • Default: no target

Docker target to build to.

Only allowed when directoryName is specified.


dockerCacheDisabledOptional

public java.lang.Boolean getDockerCacheDisabled();
  • Type: java.lang.Boolean
  • Default: cache is used

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


dockerCacheFromOptional

public java.util.List<DockerCacheOption> getDockerCacheFrom();

Cache from options to pass to the docker build command.


dockerCacheToOptional

public DockerCacheOption getDockerCacheTo();

Cache to options to pass to the docker build command.


dockerFileOptional

public java.lang.String getDockerFile();
  • Type: java.lang.String
  • Default: no file

Path to the Dockerfile (relative to the directory).

Only allowed when directoryName is specified.


dockerOutputsOptional

public java.util.List<java.lang.String> getDockerOutputs();
  • Type: java.util.List
  • Default: no build args are passed

Outputs to pass to the docker build command.


executableOptional

public java.util.List<java.lang.String> getExecutable();
  • Type: java.util.List
  • 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 java.lang.String getNetworkMode();
  • Type: java.lang.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 java.lang.String getPlatform();
  • Type: java.lang.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.