Reusable sandbox configuration template.
Example
template = Puck.Sandbox.Runtime.Template.new(adapter: MyAdapter, config: %{image: "python:3.12"})
{:ok, sandbox} = Puck.Sandbox.Runtime.create(template)
# With overrides
{:ok, sandbox} = Puck.Sandbox.Runtime.create(@python_template, memory_mb: 1024)
Summary
Functions
Merges override config into template config.
Creates a new template.
Returns the backend tuple for Runtime.create/1.
Types
Functions
Merges override config into template config.
Uses deep merge for nested maps, with overrides taking precedence.
Examples
template = Template.new({Docker, %{image: "python", memory_mb: 256}})
merged = Template.merge(template, %{memory_mb: 512, cpu: 2})
# => %{image: "python", memory_mb: 512, cpu: 2}
Creates a new template.
Examples
# Keyword syntax
Template.new(adapter: Docker, config: %{image: "python:3.12"})
# Tuple syntax (same as Runtime.create/1)
Template.new({Docker, %{image: "python:3.12", memory_mb: 512}})
Template.new({Docker, image: "python:3.12", memory_mb: 512})
Returns the backend tuple for Runtime.create/1.
Examples
template = Template.new({Docker, %{image: "python"}})
Template.to_backend(template)
# => {Docker, %{image: "python"}}
Template.to_backend(template, %{memory_mb: 512})
# => {Docker, %{image: "python", memory_mb: 512}}