Skip to main content
Use runtime defaults when every sandbox created from a template should start in a specific directory or as a specific user.
builder = (
    Template()
    .from_python_image("3.12")
    .make_dir("/workspace/app")
    .copy("./app.py", "/workspace/app/app.py")
    .set_workdir("/workspace/app")
    .set_user("user")
    .set_runtime_envs({"APP_ENV": "production"})
)
set_workdir() and set_user() become defaults for sandboxes launched from the template. Individual build steps can still specify their own user when needed:
builder = builder.run_cmd("python3 -m compileall /workspace/app", user="user")
Build-time environment variables are separate from runtime defaults:
builder = builder.set_build_envs({
    "PIP_INDEX_URL": "https://example.invalid/simple",
})