Interface DockerCacheOption

All Superinterfaces:
software.amazon.jsii.JsiiSerializable
All Known Implementing Classes:
DockerCacheOption.Jsii$Proxy

@Generated(value="jsii-pacmak/1.103.1 (build bef2dea)", date="2024-10-11T15:55:57.120Z") @Stability(Stable) public interface DockerCacheOption extends software.amazon.jsii.JsiiSerializable
Options for configuring the Docker cache backend.

Example:

 import software.amazon.awscdk.services.ecr.assets.DockerImageAsset;
 import software.amazon.awscdk.services.ecr.assets.Platform;
 DockerImageAsset asset = DockerImageAsset.Builder.create(this, "MyBuildImage")
         .directory(join(__dirname, "my-image"))
         .cacheFrom(List.of(DockerCacheOption.builder().type("registry").params(Map.of("ref", "ghcr.io/myorg/myimage:cache")).build()))
         .cacheTo(DockerCacheOption.builder().type("registry").params(Map.of("ref", "ghcr.io/myorg/myimage:cache", "mode", "max", "compression", "zstd")).build())
         .build();
 
  • Method Details

    • getType

      @Stability(Stable) @NotNull String getType()
      The type of cache to use.

      Refer to https://docs.docker.com/build/cache/backends/ for full list of backends.

      Default: - unspecified

      Example:

       "registry";
       
    • getParams

      @Stability(Stable) @Nullable default Map<String,String> getParams()
      Any parameters to pass into the docker cache backend configuration.

      Refer to https://docs.docker.com/build/cache/backends/ for cache backend configuration.

      Default: {} No options provided

      Example:

       String branch;
       Map<String, Object> params = Map.of(
               "ref", String.format("12345678.dkr.ecr.us-west-2.amazonaws.com/cache:%s", branch),
               "mode", "max");
       
    • builder

      @Stability(Stable) static DockerCacheOption.Builder builder()
      Returns:
      a DockerCacheOption.Builder of DockerCacheOption