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
| Command | Description |
|---|---|
gb template build | Build a template from genbox.yaml |
gb template list | List all project templates |
gb template status [id] | Check template build status |
gb template delete <id> | Delete a template |
Examples
Build a Template
gb template buildBuilding 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 abc123With options:
gb template build --repo git@github.com:acme/project.git --branch develop --waitList Templates
gb template listFound 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 buildCheck Build Status
gb template statusShows 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. CleanupWhen 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: 0Watch Build Progress
gb template status abc123 --watchUpdates every 10 seconds until build completes.
Delete Template
gb template delete abc123β Template deleted.Build Options
| Option | Description |
|---|---|
-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, --wait | Wait for build to complete |
List Options
| Option | Description |
|---|---|
-p, --project <id> | Filter by project ID |
--all | Show all templates including deprecated |
--json | Output as JSON |
Status Options
| Option | Description |
|---|---|
-w, --watch | Watch build progress until complete |
Template Status
| Status | Icon | Description |
|---|---|---|
ready | β | Template is ready to use |
building | β | Build in progress |
failed | β | Build failed |
deprecated | β | Template is deprecated |
Build Process
- Create temporary server: Provisions a build server
- Clone repository: Clones your repo with specified branch
- Install dependencies: Runs install commands from genbox.yaml
- Pull Docker images: Pre-pulls required containers
- Create snapshot: Creates Hetzner snapshot of the disk
- Cleanup: Terminates build server
Benefits
| Without Template | With Template |
|---|---|
| 5-10 min boot | 1-2 min boot |
| Fresh dependencies | Pre-installed |
| Docker image pulls | Pre-pulled |
| Full setup each time | Snapshot restore |
Notes
- Templates are specific to repo + branch + genbox.yaml
- Re-run
gb template buildwhen 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
Last updated on