Add hub template

From blaxel-ai/sandbox · View interactive version

Add hub template is an AI agent skill from the GitHub repository blaxel-ai/sandbox. Add or update a Blaxel Sandbox Hub image/template under hub/. Use when adding a new hub image, sandbox image, runtime image, template.json, Dockerfile, hidden/internal image, or workflow-dispatch build option in the blaxel-ai/sandbox repository.

How to use this skill

Skill file

Add a Sandbox Hub Image

Use this skill for new images under hub/<name>/, including visible templates and hidden/internal runtime images.

Scope First

  1. Check repository instructions at the relevant scope before editing.
  2. Inspect nearby templates:
  1. Check the current git status and preserve unrelated user changes.
  2. Decide whether the image is user-facing or internal:

Required Files

Create or update:

Usually update for local testing:

Only update README.md for visible user-facing templates. Do not list hidden/internal images as normal templates.

Dockerfile Rules

Follow the existing multi-stage pattern:

ARG SANDBOX_VERSION=latest
FROM ghcr.io/blaxel-ai/sandbox:${SANDBOX_VERSION} AS sandbox-api

FROM <runtime-base>

RUN <install required runtime tools>

WORKDIR /blaxel

COPY --from=sandbox-api /sandbox-api /usr/local/bin/sandbox-api
RUN chmod +x /usr/local/bin/sandbox-api

EXPOSE 8080

ENV HOME=/blaxel

ENTRYPOINT ["/usr/local/bin/sandbox-api"]

Rules:

template.json Rules

Minimal shape:

{
  "name": "<name>",
  "displayName": "<Display Name>",
  "categories": [],
  "description": "Short description.",
  "longDescription": "Longer description.",
  "url": "https://github.com/blaxel-ai/sandbox",
  "icon": "https://blaxel.ai/logo.png",
  "memory": 2048,
  "ports": [
    {
      "name": "sandbox-api",
      "target": 8080,
      "protocol": "HTTP"
    }
  ],
  "enterprise": false,
  "coming_soon": false
}

For hidden/internal images, add:

"hidden": true

Port rule: put only stable ports in template.json. If another service creates previews with a caller-provided runtime.port, leave that dynamic port out of the template.

GitHub Workflow

Update .github/workflows/build.yaml every time a new hub image is added:

The automatic build matrix uses folders under hub/, so the directory is enough for push/tag auto-detection. The workflow_dispatch options list is separate and must be updated manually.

docker-compose

Add a service when local build/run is useful:

  <name>:
    platform: linux/amd64
    build:
      context: .
      dockerfile: hub/<name>/Dockerfile
    env_file:
      - .env
    ports:
      - "8080:8080"
      - "3010:3010"

Add app ports only when they are stable template ports. Avoid dynamic platform-managed app ports.

Validation

Run the cheapest structural checks first:

jq empty hub/<name>/template.json
find hub/<name> -maxdepth 1 -name '*.sh' -print -exec sh -n {} \;
ruby -e 'require "yaml"; YAML.load_file(".github/workflows/build.yaml"); puts "yaml-ok"'

Build with an explicit platform:

docker build --platform linux/amd64 -t blaxel/<name>:test -f hub/<name>/Dockerfile .

Prefer explicit docker build --platform linux/amd64 over docker compose build on Apple Silicon. Some local compose providers ignore the service platform when pulling ghcr.io/blaxel-ai/sandbox:latest and fail on arm64.

If the image has a runner or entrypoint script, smoke-test it inside the built image with realistic env vars and mounted test input. Verify:

When feasible, start the sandbox API and check:

curl http://localhost:8080/health
curl -X POST http://localhost:8080/process \
  -H "Content-Type: application/json" \
  -d '{"command": "echo hello", "waitForCompletion": true}'

Final Checklist

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.