このコンテンツはまだ日本語訳がありません。
Declarative image builder used to define Sandbox runtime environments.
Use factory methods such as #base(String) or #debianSlim(String) and chain
mutating methods to append Dockerfile instructions.
Methods
Section titled “Methods”base()
Section titled “base()”public static Image base(String baseImage)Creates an image definition from an existing base image.
Parameters:
baseImageString - base image reference (for examplepython:3.12-slim-bookworm)
Returns:
Image- newImageinitialized with aFROMinstruction
debianSlim()
Section titled “debianSlim()”public static Image debianSlim(String pythonVersion)Creates a Python Debian slim image.
Parameters:
pythonVersionString - Python version to use; defaults to3.11whennullor empty
Returns:
Image- newImageusing a Python slim base image
pipInstall()
Section titled “pipInstall()”public Image pipInstall(String... packages)Adds a pip install instruction for one or more packages.
Parameters:
packagesString… - package names to install
Returns:
Image- thisImagefor method chaining
runCommands()
Section titled “runCommands()”public Image runCommands(String... commands)Adds one or more RUN instructions.
Parameters:
commandsString… - shell commands to execute during image build
Returns:
Image- thisImagefor method chaining
public Image env(Map<String, String> envVars)Adds environment variables using ENV instructions.
Parameters:
envVarsMap<String, String> - environment variables to set in the image
Returns:
Image- thisImagefor method chaining
workdir()
Section titled “workdir()”public Image workdir(String path)Sets the default working directory using a WORKDIR instruction.
Parameters:
pathString - working directory path
Returns:
Image- thisImagefor method chaining
entrypoint()
Section titled “entrypoint()”public Image entrypoint(String... commands)Sets the container entrypoint.
Parameters:
commandsString… - entrypoint command and arguments
Returns:
Image- thisImagefor method chaining
public Image cmd(String... commands)Sets the default container command.
Parameters:
commandsString… - default command and arguments
Returns:
Image- thisImagefor method chaining
getDockerfile()
Section titled “getDockerfile()”public String getDockerfile()Returns generated Dockerfile content.
Returns:
String- Dockerfile text assembled by this builder