Apothic Client Image Reference
Reference for Image constructors and builder methods, including registry images, Dockerfiles, pip, apt, environment variables, and build-context mounts.
Last updated: 4/23/2026
API Version: v0.1.0
apothic-clientapireferenceimage
Apothic Client Image Reference
Image is the builder used to describe execution environments for functions, services, classes, and sandboxes.
Image instances are immutable builders: each mutating-looking method returns a new Image.
Constructors
Image.debian_slim(*, python_version: str = "3.11") -> Image
Image.from_registry(image_ref: str, *, prebuilt: bool = False) -> Image
Image.from_dockerfile(
path: str,
*,
context_dir: str | None = None,
base: str = "python:3.11-slim",
) -> Image
Python dependencies
image.pip_install(*packages: str) -> Image
image.uv_pip_install(*packages: str) -> Image
image.pip_install_from_requirements(path: str) -> Image
image.uv_pip_install_from_requirements(path: str) -> Image
image.pip_install_from_pyproject(
path: str,
*,
optional_dependencies: str | list[str] | None = None,
) -> Image
image.uv_pip_install_from_pyproject(
path: str,
*,
optional_dependencies: str | list[str] | None = None,
) -> Image
Environment variables and shell commands
image.env(values: dict[str, Any] | None = None, /, **kwargs: Any) -> Image
image.env_file(path: str) -> Image
image.run_commands(*commands: str) -> Image
image.command_shell(shell: str | None) -> Image
image.workdir(path: str) -> Image
System packages
image.apt_install(*packages: str) -> Image
Dockerfile overrides
image.with_dockerfile(contents: str) -> Image
Add local files and directories
image.add_local_file(local_path: str, remote_path: str | None = None) -> Image
image.add_local_dir(local_path: str, remote_path: str | None = None) -> Image
image.copy_local_file(local_path: str, remote_path: str | None = None) -> Image
image.copy_local_dir(local_path: str, remote_path: str | None = None) -> Image
Add local Python source
image.add_local_python_source(*modules: str) -> Image
image.copy_local_python_source(*modules: str) -> Image
Conversion
image.to_spec() -> ImageSpec
Common patterns
Simple Python base
Image.debian_slim(python_version="3.12").pip_install("numpy", "pandas")
Registry image with small customization
Image.from_registry("python:3.12-slim").uv_pip_install("numpy").env(PYTHONUNBUFFERED="1")
Local Dockerfile
Image.from_dockerfile("./Dockerfile", context_dir=".")
Bundled local package
Image.debian_slim().add_local_python_source("my_package")
Runtime execution notes
- Simple registry-base images can execute directly without forcing a custom derived image first.
- Richer image specs with extra context, commands, or packaging layers can publish and reuse derived execution images.
- Python-less Linux base images are also supported. When the image does not already contain a suitable Python runtime, the current runtime can fall back to a managed CPython for execution and later reuse an optimized derived image when needed.
