Skip to main content

Command

Description

Builds your agent into a production-ready Docker image. This packages your agent code, dependencies, and runtime into a container for deployment.

Usage

Build from your agent/ directory:

Expected Output

What Gets Built

The build process:
  1. Generates Dockerfile - Creates .sb0/Dockerfile.agent based on your config
  2. Installs system packages - From agent.config.yaml
  3. Installs Python dependencies - From pyproject.toml and uv.lock
  4. Copies agent code - Your handle_query.py and other files
  5. Packages sb0 runtime - Includes sb0-runner and sb0-protocol
  6. Creates Docker image - Tagged according to agent.config.yaml

Image Name

The image name is defined in your agent.config.yaml:

.dockerignore Warning

If .dockerignore is missing, you’ll see a warning:
Solution: Create a .dockerignore file:

When to Build

You need to build when:
  • Deploying to production - Before running sb0 push
  • Configuration changes - After modifying agent.config.yaml
  • System package changes - After adding to system_packages
  • Final testing - To verify Docker image works correctly
You do NOT need to build for:
  • Local testing - Use sb0 run --prompt instead
  • Python code changes - Test with sb0 run without rebuilding
  • Adding Python dependencies - Test locally first, build when ready to deploy

Build Platforms

Builds for your native platform by default:
  • Apple Silicon (M1/M2/M3) - linux/arm64
  • Intel/AMD - linux/amd64

Requirements

  • Docker must be running - Start Docker Desktop or Docker daemon
  • Must run from agent directory - The directory containing agent.config.yaml
  • Valid configuration - agent.config.yaml must be properly formatted

Common Issues

Docker Not Running

Solution: Start Docker Desktop or the Docker daemon.

Invalid Configuration

Solution: Fix errors in agent.config.yaml and try again.

Generated Files

Building creates:
  • .sb0/Dockerfile.agent - Generated Dockerfile (don’t edit manually)
  • Docker image - Tagged according to your config
The .sb0/Dockerfile.agent is automatically generated. Don’t edit it manually—your changes will be overwritten on the next build.

Next Steps

After building:
  1. Test the image locally (optional):
  2. Deploy to platform: