public static class ContainerBuildPlan.Builder
extends java.lang.Object
ContainerBuildPlan.| Modifier and Type | Method and Description |
|---|---|
ContainerBuildPlan.Builder |
addEnvironmentVariable(java.lang.String name,
java.lang.String value)
Adds a variable in the container environment.
|
ContainerBuildPlan.Builder |
addExposedPort(Port exposedPort)
Adds a port to expose from the container.
|
ContainerBuildPlan.Builder |
addLabel(java.lang.String key,
java.lang.String value)
Sets a label for the container.
|
ContainerBuildPlan.Builder |
addLayer(LayerObject layer) |
ContainerBuildPlan.Builder |
addPlatform(java.lang.String architecture,
java.lang.String os)
Adds a desired image platform (OS and architecture pair).
|
ContainerBuildPlan.Builder |
addVolume(AbsoluteUnixPath volume)
Adds a directory that may hold an externally mounted volume.
|
ContainerBuildPlan |
build()
Returns the built
ContainerBuildPlan. |
ContainerBuildPlan.Builder |
setBaseImage(java.lang.String baseImage)
Image reference to a base image.
|
ContainerBuildPlan.Builder |
setCmd(java.util.List<java.lang.String> cmd)
Sets the container entrypoint program arguments.
|
ContainerBuildPlan.Builder |
setCreationTime(java.time.Instant creationTime)
Sets the container image creation time.
|
ContainerBuildPlan.Builder |
setEntrypoint(java.util.List<java.lang.String> entrypoint)
Sets the container entrypoint.
|
ContainerBuildPlan.Builder |
setEnvironment(java.util.Map<java.lang.String,java.lang.String> environment)
Sets the container environment.
|
ContainerBuildPlan.Builder |
setExposedPorts(java.util.Set<Port> exposedPorts)
Sets the ports to expose from the container.
|
ContainerBuildPlan.Builder |
setFormat(ImageFormat format)
Sets the format to build the container image as.
|
ContainerBuildPlan.Builder |
setLabels(java.util.Map<java.lang.String,java.lang.String> labels)
Sets the labels for the container.
|
ContainerBuildPlan.Builder |
setLayers(java.util.List<? extends LayerObject> layer) |
ContainerBuildPlan.Builder |
setPlatforms(java.util.Set<Platform> platforms)
Sets a desired platform (properties including OS and architecture) list.
|
ContainerBuildPlan.Builder |
setUser(java.lang.String user)
Sets the user and group to run the container as.
|
ContainerBuildPlan.Builder |
setVolumes(java.util.Set<AbsoluteUnixPath> volumes)
Sets the directories that may hold externally mounted volumes.
|
ContainerBuildPlan.Builder |
setWorkingDirectory(AbsoluteUnixPath workingDirectory)
Sets the working directory in the container.
|
public ContainerBuildPlan.Builder setBaseImage(java.lang.String baseImage)
scratch.baseImage - image reference to a base imagepublic ContainerBuildPlan.Builder addPlatform(java.lang.String architecture, java.lang.String os)
Note that a new build plan starts with "amd64/linux" as the default platform. If you want
to reset the default platform instead of adding a new one, use setPlatforms(Set).
architecture - architecture (for example, amd64) to select a base image in case
of a manifest listos - OS (for example, linux) to select a base image in case of a manifest listpublic ContainerBuildPlan.Builder setPlatforms(java.util.Set<Platform> platforms)
Note that a new build plan starts with "amd64/linux" as the default platform.
platforms - list of platforms to select base images in case of a manifest listpublic ContainerBuildPlan.Builder setCreationTime(java.time.Instant creationTime)
Instant.EPOCH.creationTime - the container image creation timepublic ContainerBuildPlan.Builder setFormat(ImageFormat format)
ImageFormat.Docker for Docker
V2.2 or ImageFormat.OCI for OCI.format - the ImageFormatpublic ContainerBuildPlan.Builder setEnvironment(java.util.Map<java.lang.String,java.lang.String> environment)
This is similar to ENV in Dockerfiles or env in the Kubernetes
Container spec.
environment - a map of environment variable names to valuespublic ContainerBuildPlan.Builder addEnvironmentVariable(java.lang.String name, java.lang.String value)
name - the environment variable namevalue - the environment variable valuesetEnvironment(java.util.Map<java.lang.String, java.lang.String>)public ContainerBuildPlan.Builder setVolumes(java.util.Set<AbsoluteUnixPath> volumes)
This is similar to VOLUME in
Dockerfiles.
volumes - the directory paths on the container filesystem to set as volumespublic ContainerBuildPlan.Builder addVolume(AbsoluteUnixPath volume)
volume - a directory path on the container filesystem to represent a volumesetVolumes(Set)public ContainerBuildPlan.Builder setLabels(java.util.Map<java.lang.String,java.lang.String> labels)
This is similar to LABEL in
Dockerfiles.
labels - a map of label keys to valuespublic ContainerBuildPlan.Builder addLabel(java.lang.String key, java.lang.String value)
key - the label keyvalue - the label valuepublic ContainerBuildPlan.Builder setExposedPorts(java.util.Set<Port> exposedPorts)
Use Port.tcp(int) to expose a port for TCP traffic and Port.udp(int) to expose a
port for UDP traffic.
This is similar to EXPOSE in
Dockerfiles or ports in the Kubernetes
Container spec.
exposedPorts - the ports to exposepublic ContainerBuildPlan.Builder addExposedPort(Port exposedPort)
exposedPort - the port to exposesetExposedPorts(Set)public ContainerBuildPlan.Builder setUser(@Nullable java.lang.String user)
user can be a username or UID along
with an optional groupname or GID. null signals to use the base image value.
The following are valid formats for user
user
uid
:group
:gid
user:group
uid:gid
uid:group
user:gid
user - the user to run the container aspublic ContainerBuildPlan.Builder setWorkingDirectory(@Nullable AbsoluteUnixPath workingDirectory)
null signals to use the base image
value.workingDirectory - the working directorypublic ContainerBuildPlan.Builder setEntrypoint(@Nullable java.util.List<java.lang.String> entrypoint)
setCmd(java.util.List<java.lang.String>) sets additional tokens. null signals to use the
base image value.
This is similar to ENTRYPOINT in Dockerfiles or command in the Kubernetes
Container spec.
entrypoint - a list of the entrypoint commandpublic ContainerBuildPlan.Builder setCmd(@Nullable java.util.List<java.lang.String> cmd)
null signals to use the base image value (only when
entrypoint is also null).
This is similar to CMD in Dockerfiles or args in the Kubernetes
Container spec.
For example, if the entrypoint was myprogram --flag subcommand and program
arguments were hello world, then the command that run when the container starts is
myprogram --flag subcommand hello world.
cmd - a list of program argument tokenspublic ContainerBuildPlan.Builder addLayer(LayerObject layer)
public ContainerBuildPlan.Builder setLayers(java.util.List<? extends LayerObject> layer)
public ContainerBuildPlan build()
ContainerBuildPlan.