Image instance.
Image.base()
Start from the default OpenSandbox environment (Ubuntu 22.04, Python, Node.js, build tools).
Image
Builder Methods
image.apt_install(packages)
list[str]
required
System packages to install via apt-get
Image
image.pip_install(packages)
list[str]
required
Python packages to install via pip
Image
image.run_commands(*cmds)
str (variadic)
required
Shell commands to run during build
Image
image.env(vars)
dict[str, str]
required
Environment variables to set
Image
image.workdir(path)
str
required
Default working directory
Image
image.add_file(remote_path, content)
str
required
Destination path in the image
str
required
File content
Image
image.add_local_file(local_path, remote_path)
str
required
Path to the local file
str
required
Destination path in the image
Image
image.add_local_dir(local_path, remote_path)
str
required
Path to the local directory
str
required
Destination path in the image
Image
image.builder_memory(mb)
Sets the RAM (in MB) used during the build phase. Raise this when a build OOMs
(heavy apt/pip/npm). Defaults to 4096. Does not affect the resulting
sandbox’s memory — size that at create time via memory_mb.
int
required
Build-phase memory in MB
Image
Utility Methods
image.to_dict()
Returns the image manifest as a plain dict.
Returns: dict
image.cache_key()
Computes a deterministic SHA-256 hash of the manifest for cache lookups.
Returns: str