Skip to main content
Gravix Layer provides public base templates that are ready to use out of the box. You can also build your own custom templates from public Docker images.

Public Base Templates

Pre-built templates are available in all supported regions. Built on python:3.12.13-slim.
TemplateResourcesProvider / Region
python-3.12-base-small1 vCPU / 1 GB RAM / 2 GB diskazure / eastus2
python-3.12-base-medium1 vCPU / 2 GB RAM / 4 GB diskazure / eastus2
python-3.12-base-large2 vCPU / 4 GB RAM / 8 GB diskazure / eastus2
from gravixlayer import GravixLayer

client = GravixLayer()

# Use a public base template directly
runtime = client.runtime.create(template="python-3.12-base-small")

Build a Custom Template

Custom templates let you define your own environment from any public Docker image. Currently supports Ubuntu, Alpine, and Debian based images.
from gravixlayer import GravixLayer, TemplateBuilder

client = GravixLayer()

builder = (
    TemplateBuilder("my-python-app")
    .from_image("python:3.11-slim")
    .vcpu(2)
    .memory(512)
    .disk(4096)
    .pip_install("fastapi", "uvicorn")
)

status = client.templates.build_and_wait(builder, timeout_secs=600)
print(status.template_id)

TemplateBuilder Methods

  • Base: from_image or dockerfile
  • Build steps: run, apt_install, pip_install, npm_install, copy_file, copy_dir, git_clone, mkdir
  • Runtime launch: start_cmd
  • Readiness: ready_cmd with wait_for_port or wait_for_process
  • Resources: vcpu, memory, disk
  • Environment: env, envs, tags

Manage Templates

from gravixlayer import GravixLayer

client = GravixLayer()

# List templates
page = client.templates.list()
for t in page.templates:
    print(f"{t.name}: {t.description}")

# Get template details
info = client.templates.get("your-template-id")
print(info.template_id, info.status)

# Delete a template
client.templates.delete("your-template-id")

Build Status Values

StatusDescription
queuedBuild is queued
buildingBuild in progress
readyTemplate is ready to use
failedBuild failed
cancelledBuild was cancelled
Use build_and_wait for a simple blocking workflow. It starts the build and polls until the template reaches a terminal state.