Base image
Every template starts from a source environment. The SDK supports several entry points depending on how much control you need.fromPythonImage(...)/from_python_image(...)for a standard Python runtimefromUbuntuImage(...)/from_ubuntu_image(...)orfromDebianImage(...)/from_debian_image(...)for a standard Linux basefromNodeImage(...)/from_node_image(...)andfromBunImage(...)/from_bun_image(...)for language-specific basesfromImage(...)/from_image(...)for an arbitrary container imagefromDockerfile(...)/from_dockerfile(...)when your Dockerfile is already the source of truthfromBaseImage()/from_base_image()to start from the platform default basefromTemplate(...)/from_template(...)to layer on top of another template
fromPythonImage("3.12") and from_python_image("3.12") are equivalent to starting from:
Dockerfile
Private registries
If your base image lives in a private registry, pass credentials when defining the template source. The JS and Python SDKs support:- generic registry credentials with username and password
- AWS registry credentials
- GCP registry credentials
- Huawei Cloud registry credentials
Defining template
The builder API lets you compose the final environment directly in code. Common definition steps include:runCmd(...)/run_cmd(...)to install packages or run provisioning commandscopy(...)to include local filesmakeDir(...),remove(...),rename(...), andmakeSymlink(...)for filesystem shapingsetEnvs(...)/set_envs(...)for environment variablespipInstall(...),npmInstall(...),bunInstall(...), andaptInstall(...)for package setupgitClone(...)/git_clone(...)to bring code into the image
Start & ready commands
Use a start command when the template should boot a long-running service during the build result, and use a ready command to define when that service is considered healthy. This is useful for web apps, API servers, background workers, and any template that should already be initialized when a sandbox starts.setReadyCmd(...) / set_ready_cmd(...).