Class DockerImageAsset.Builder

java.lang.Object
software.amazon.awscdk.services.ecr.assets.DockerImageAsset.Builder
All Implemented Interfaces:
software.amazon.jsii.Builder<DockerImageAsset>
Enclosing class:
DockerImageAsset

@Stability(Stable) public static final class DockerImageAsset.Builder extends Object implements software.amazon.jsii.Builder<DockerImageAsset>
A fluent builder for DockerImageAsset.
  • Method Details

    • create

      @Stability(Stable) public static DockerImageAsset.Builder create(software.constructs.Construct scope, String id)
      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
      Returns:
      a new instance of DockerImageAsset.Builder.
    • exclude

      @Stability(Stable) public DockerImageAsset.Builder exclude(List<String> exclude)
      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.

      Default: - nothing is excluded

      Parameters:
      exclude - File paths matching the patterns will be excluded. This parameter is required.
      Returns:
      this
    • followSymlinks

      @Stability(Stable) public DockerImageAsset.Builder followSymlinks(SymlinkFollowMode followSymlinks)
      A strategy for how to handle symlinks.

      Default: SymlinkFollowMode.NEVER

      Parameters:
      followSymlinks - A strategy for how to handle symlinks. This parameter is required.
      Returns:
      this
    • ignoreMode

      @Stability(Stable) public DockerImageAsset.Builder ignoreMode(IgnoreMode ignoreMode)
      The ignore behavior to use for exclude patterns.

      Default: IgnoreMode.GLOB

      Parameters:
      ignoreMode - The ignore behavior to use for exclude patterns. This parameter is required.
      Returns:
      this
    • extraHash

      @Stability(Stable) public DockerImageAsset.Builder extraHash(String extraHash)
      Extra information to encode into the fingerprint (e.g. build instructions and other inputs).

      Default: - hash is only based on source content

      Parameters:
      extraHash - Extra information to encode into the fingerprint (e.g. build instructions and other inputs). This parameter is required.
      Returns:
      this
    • assetName

      @Stability(Stable) public DockerImageAsset.Builder assetName(String assetName)
      Unique identifier of the docker image asset and its potential revisions.

      Required if using AppScopedStagingSynthesizer.

      Default: - no asset name

      Parameters:
      assetName - Unique identifier of the docker image asset and its potential revisions. This parameter is required.
      Returns:
      this
    • buildArgs

      @Stability(Stable) public DockerImageAsset.Builder buildArgs(Map<String,String> buildArgs)
      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).

      Default: - no build args are passed

      Parameters:
      buildArgs - Build args to pass to the docker build command. This parameter is required.
      Returns:
      this
    • buildSecrets

      @Stability(Stable) public DockerImageAsset.Builder buildSecrets(Map<String,String> buildSecrets)
      Build secrets.

      Docker BuildKit must be enabled to use build secrets.

      Default: - no build secrets

      Example:

       import software.amazon.awscdk.DockerBuildSecret;
       Map<String, String> buildSecrets = Map.of(
               "MY_SECRET", DockerBuildSecret.fromSrc("file.txt"));
       

      Parameters:
      buildSecrets - Build secrets. This parameter is required.
      Returns:
      this
      See Also:
    • buildSsh

      @Stability(Stable) public DockerImageAsset.Builder buildSsh(String buildSsh)
      SSH agent socket or keys to pass to the docker build command.

      Docker BuildKit must be enabled to use the ssh flag

      Default: - no --ssh flag

      Parameters:
      buildSsh - SSH agent socket or keys to pass to the docker build command. This parameter is required.
      Returns:
      this
      See Also:
    • cacheDisabled

      @Stability(Stable) public DockerImageAsset.Builder cacheDisabled(Boolean cacheDisabled)
      Disable the cache and pass --no-cache to the docker build command.

      Default: - cache is used

      Parameters:
      cacheDisabled - Disable the cache and pass --no-cache to the docker build command. This parameter is required.
      Returns:
      this
    • cacheFrom

      @Stability(Stable) public DockerImageAsset.Builder cacheFrom(List<? extends DockerCacheOption> cacheFrom)
      Cache from options to pass to the docker build command.

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

      Parameters:
      cacheFrom - Cache from options to pass to the docker build command. This parameter is required.
      Returns:
      this
      See Also:
    • cacheTo

      @Stability(Stable) public DockerImageAsset.Builder cacheTo(DockerCacheOption cacheTo)
      Cache to options to pass to the docker build command.

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

      Parameters:
      cacheTo - Cache to options to pass to the docker build command. This parameter is required.
      Returns:
      this
      See Also:
    • file

      @Stability(Stable) public DockerImageAsset.Builder file(String file)
      Path to the Dockerfile (relative to the directory).

      Default: 'Dockerfile'

      Parameters:
      file - Path to the Dockerfile (relative to the directory). This parameter is required.
      Returns:
      this
    • invalidation

      @Stability(Stable) public DockerImageAsset.Builder invalidation(DockerImageAssetInvalidationOptions invalidation)
      Options to control which parameters are used to invalidate the asset hash.

      Default: - hash all parameters

      Parameters:
      invalidation - Options to control which parameters are used to invalidate the asset hash. This parameter is required.
      Returns:
      this
    • networkMode

      @Stability(Stable) public DockerImageAsset.Builder networkMode(NetworkMode networkMode)
      Networking mode for the RUN commands during build.

      Support docker API 1.25+.

      Default: - no networking mode specified (the default networking mode `NetworkMode.DEFAULT` will be used)

      Parameters:
      networkMode - Networking mode for the RUN commands during build. This parameter is required.
      Returns:
      this
    • outputs

      @Stability(Stable) public DockerImageAsset.Builder outputs(List<String> outputs)
      Outputs to pass to the docker build command.

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

      Parameters:
      outputs - Outputs to pass to the docker build command. This parameter is required.
      Returns:
      this
      See Also:
    • platform

      @Stability(Stable) public DockerImageAsset.Builder platform(Platform platform)
      Platform to build for.

      Requires Docker Buildx.

      Default: - no platform specified (the current machine architecture will be used)

      Parameters:
      platform - Platform to build for. This parameter is required.
      Returns:
      this
    • target

      @Stability(Stable) public DockerImageAsset.Builder target(String target)
      Docker target to build to.

      Default: - no target

      Parameters:
      target - Docker target to build to. This parameter is required.
      Returns:
      this
    • directory

      @Stability(Stable) public DockerImageAsset.Builder directory(String directory)
      The directory where the Dockerfile is stored.

      Any directory inside with a name that matches the CDK output folder (cdk.out by default) will be excluded from the asset

      Parameters:
      directory - The directory where the Dockerfile is stored. This parameter is required.
      Returns:
      this
    • build

      @Stability(Stable) public DockerImageAsset build()
      Specified by:
      build in interface software.amazon.jsii.Builder<DockerImageAsset>
      Returns:
      a newly built instance of DockerImageAsset.