Skip to Content
New to Genbox? Check out our Getting Started guide
Commandstemplate

gb template

Manage project templates (golden images) for fast genbox boot.

Synopsis

gb template <command> [options]

Description

Build and manage project templates that create pre-configured snapshots of your development environment. Templates dramatically reduce genbox creation time by starting from a snapshot instead of provisioning from scratch.

Subcommands

CommandDescription
gb template buildBuild a template from genbox.yaml
gb template listList all project templates
gb template status [id]Check template build status
gb template delete <id>Delete a template

Examples

Build a Template

gb template build
Building template: Repo: git@github.com:acme/project.git Branch: main Initiating template build... βœ“ Template build started Name: project-main-a1b2c3 Version: v1 Build typically takes 10-20 minutes. Check progress: gb template status abc123

With options:

gb template build --repo git@github.com:acme/project.git --branch develop --wait

List Templates

gb template list
Found 3 templates: βœ“ project-main-a1b2c3 4.2GB 2d ago (15 uses) github.com/acme/project@main βœ“ api-develop-d4e5f6 3.8GB 1w ago (8 uses) github.com/acme/api@develop β—‹ frontend-main-g7h8i9 - just now github.com/acme/frontend@main ────────────────────────────────────────────────── Build new: gb template build

Check Build Status

gb template status

Shows status of most recent building template:

Template: project-main-a1b2c3 Status: building Version: v1 Repo: github.com/acme/project Branch: main Building... (5m 23s) Build steps: 1. Create temporary server 2. Clone repository 3. Install dependencies 4. Pull Docker images 5. Create snapshot 6. Cleanup

When complete:

Template: project-main-a1b2c3 Status: ready Version: v1 Repo: github.com/acme/project Branch: main Ready to use! Size: 4.2 GB Duration: 12m 45s Uses: 0

Watch Build Progress

gb template status abc123 --watch

Updates every 10 seconds until build completes.

Delete Template

gb template delete abc123
βœ“ Template deleted.

Build Options

OptionDescription
-r, --repo <url>Git repository URL (auto-detected from current directory)
-b, --branch <name>Git branch (default: main, or current branch)
-p, --project <id>Project ID to associate with
-w, --waitWait for build to complete

List Options

OptionDescription
-p, --project <id>Filter by project ID
--allShow all templates including deprecated
--jsonOutput as JSON

Status Options

OptionDescription
-w, --watchWatch build progress until complete

Template Status

StatusIconDescription
readyβœ“Template is ready to use
buildingβ—‹Build in progress
failedβœ—Build failed
deprecated–Template is deprecated

Build Process

  1. Create temporary server: Provisions a build server
  2. Clone repository: Clones your repo with specified branch
  3. Install dependencies: Runs install commands from genbox.yaml
  4. Pull Docker images: Pre-pulls required containers
  5. Create snapshot: Creates Hetzner snapshot of the disk
  6. Cleanup: Terminates build server

Benefits

Without TemplateWith Template
5-10 min boot1-2 min boot
Fresh dependenciesPre-installed
Docker image pullsPre-pulled
Full setup each timeSnapshot restore

Notes

  • Templates are specific to repo + branch + genbox.yaml
  • Re-run gb template build when dependencies change significantly
  • Templates auto-detect existing identical configurations
  • Build typically takes 10-20 minutes
  • Snapshot size varies based on project (usually 3-5 GB)

See Also

  • gb create - Create genbox (uses template if available)
  • gb new - Create from starter template
  • gb init - Initialize genbox.yaml
Last updated on