public static class BuildContext.Builder
extends java.lang.Object
BuildContext
. Instantiate with BuildContext.builder()
.Modifier and Type | Method and Description |
---|---|
BuildContext |
build()
Builds a new
BuildContext using the parameters passed into the builder. |
BuildContext.Builder |
setAdditionalTargetImageTags(java.util.Set<java.lang.String> tags)
Sets the tags to tag the target image with (in addition to the tag in the target image
configuration image reference set via
setTargetImageConfiguration(com.google.cloud.tools.jib.configuration.ImageConfiguration) ). |
BuildContext.Builder |
setAllowInsecureRegistries(boolean allowInsecureRegistries)
Sets whether or not to allow communication over HTTP (as opposed to HTTPS).
|
BuildContext.Builder |
setAlwaysCacheBaseImage(boolean alwaysCacheBaseImage)
Controls the optimization which skips downloading base image layers that exist in a target
registry.
|
BuildContext.Builder |
setApplicationLayersCacheDirectory(java.nio.file.Path applicationLayersCacheDirectory)
Sets the location of the cache for storing application layers.
|
BuildContext.Builder |
setBaseImageConfiguration(ImageConfiguration imageConfiguration)
Sets the base image configuration.
|
BuildContext.Builder |
setBaseImageLayersCacheDirectory(java.nio.file.Path baseImageLayersCacheDirectory)
Sets the location of the cache for storing base image layers.
|
BuildContext.Builder |
setContainerConfiguration(ContainerConfiguration containerConfiguration)
Sets configuration parameters for the container.
|
BuildContext.Builder |
setEnablePlatformTags(boolean enablePlatformTags)
Sets whether to automatically add architecture suffix to tags for platform-specific images
when building multi-platform images.
|
BuildContext.Builder |
setEventHandlers(EventHandlers eventHandlers)
Sets the
EventHandlers to dispatch events with. |
BuildContext.Builder |
setExecutorService(java.util.concurrent.ExecutorService executorService)
Sets the
ExecutorService Jib executes on. |
BuildContext.Builder |
setLayerConfigurations(java.util.List<com.google.cloud.tools.jib.api.buildplan.FileEntriesLayer> layerConfigurations)
Sets the layers to build.
|
BuildContext.Builder |
setOffline(boolean offline)
Sets whether or not to perform the build in offline mode.
|
BuildContext.Builder |
setRegistryMirrors(com.google.common.collect.ListMultimap<java.lang.String,java.lang.String> registryMirrors)
Sets the registry mirrors.
|
BuildContext.Builder |
setTargetFormat(com.google.cloud.tools.jib.api.buildplan.ImageFormat targetFormat)
Sets the target format of the container image.
|
BuildContext.Builder |
setTargetImageConfiguration(ImageConfiguration imageConfiguration)
Sets the target image configuration.
|
BuildContext.Builder |
setToolName(java.lang.String toolName)
Sets the name of the tool that is executing the build.
|
BuildContext.Builder |
setToolVersion(java.lang.String toolVersion)
Sets the version of the tool that is executing the build.
|
public BuildContext.Builder setBaseImageConfiguration(ImageConfiguration imageConfiguration)
imageConfiguration
- the ImageConfiguration
describing the base imagepublic BuildContext.Builder setTargetImageConfiguration(ImageConfiguration imageConfiguration)
imageConfiguration
- the ImageConfiguration
describing the target imagepublic BuildContext.Builder setAdditionalTargetImageTags(java.util.Set<java.lang.String> tags)
setTargetImageConfiguration(com.google.cloud.tools.jib.configuration.ImageConfiguration)
).tags
- a set of tagspublic BuildContext.Builder setEnablePlatformTags(boolean enablePlatformTags)
<tag>-amd64
and <tag>-arm64
.enablePlatformTags
- whether to append architecture suffix to tagspublic BuildContext.Builder setContainerConfiguration(ContainerConfiguration containerConfiguration)
containerConfiguration
- the ContainerConfiguration
public BuildContext.Builder setApplicationLayersCacheDirectory(java.nio.file.Path applicationLayersCacheDirectory)
applicationLayersCacheDirectory
- the application layers cache directorypublic BuildContext.Builder setBaseImageLayersCacheDirectory(java.nio.file.Path baseImageLayersCacheDirectory)
baseImageLayersCacheDirectory
- the base image layers cache directorypublic BuildContext.Builder setTargetFormat(com.google.cloud.tools.jib.api.buildplan.ImageFormat targetFormat)
targetFormat
- the target formatpublic BuildContext.Builder setAllowInsecureRegistries(boolean allowInsecureRegistries)
allowInsecureRegistries
- if true
, insecure connections will be allowedpublic BuildContext.Builder setOffline(boolean offline)
offline
- if true
, the build will run in offline modepublic BuildContext.Builder setAlwaysCacheBaseImage(boolean alwaysCacheBaseImage)
alwaysCacheBaseImage
- if true
, base image layers are always pulled and cached.
If false
, base image layers will not be pulled/cached if they already exist on
the target registry.public BuildContext.Builder setLayerConfigurations(java.util.List<com.google.cloud.tools.jib.api.buildplan.FileEntriesLayer> layerConfigurations)
layerConfigurations
- the configurations for the layerspublic BuildContext.Builder setToolName(java.lang.String toolName)
toolName
- the tool namepublic BuildContext.Builder setToolVersion(@Nullable java.lang.String toolVersion)
toolVersion
- the tool versionpublic BuildContext.Builder setEventHandlers(EventHandlers eventHandlers)
EventHandlers
to dispatch events with.eventHandlers
- the EventHandlers
public BuildContext.Builder setExecutorService(@Nullable java.util.concurrent.ExecutorService executorService)
ExecutorService
Jib executes on. By default, Jib uses Executors.newCachedThreadPool()
.executorService
- the ExecutorService
public BuildContext.Builder setRegistryMirrors(com.google.common.collect.ListMultimap<java.lang.String,java.lang.String> registryMirrors)
registryMirrors
- registry mirrorspublic BuildContext build() throws CacheDirectoryCreationException
BuildContext
using the parameters passed into the builder.CacheDirectoryCreationException
- if I/O exception occurs when creating cache directory