Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions go/cli/cmd/kagent/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ Examples:
// Add flags for build command
buildCmd.Flags().StringVar(&buildCfg.Image, "image", "", "Full image specification (e.g., ghcr.io/myorg/my-agent:v1.0.0)")
buildCmd.Flags().BoolVar(&buildCfg.Push, "push", false, "Push the image to the registry")
buildCmd.Flags().StringVar(&buildCfg.Platform, "platform", "", "Target platform for Docker build (e.g., linux/amd64, linux/arm64)")

deployCfg := &cli.DeployCfg{
Config: cfg,
Expand Down Expand Up @@ -335,6 +336,7 @@ Examples:
deployCmd.Flags().StringVar(&deployCfg.EnvFile, "env-file", "", "Path to .env file containing environment variables (including API keys)")
deployCmd.Flags().StringVar(&deployCfg.Config.Namespace, "namespace", "", "Kubernetes namespace to deploy to")
deployCmd.Flags().BoolVar(&deployCfg.DryRun, "dry-run", false, "Output YAML manifests without applying them to the cluster")
deployCmd.Flags().StringVar(&deployCfg.Platform, "platform", "", "Target platform for Docker build (e.g., linux/amd64, linux/arm64)")

// add-mcp command
addMcpCfg := &cli.AddMcpCfg{Config: cfg}
Expand Down
13 changes: 11 additions & 2 deletions go/cli/internal/cli/agent/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ type BuildCfg struct {
ProjectDir string
Image string
Push bool
Platform string
Config *config.Config
}

Expand Down Expand Up @@ -52,7 +53,11 @@ func BuildCmd(cfg *BuildCfg) error {
}

imageName := constructImageName(cfg)
if err := docker.Build(imageName, "."); err != nil {
var extraArgs []string
if cfg.Platform != "" {
extraArgs = append(extraArgs, "--platform", cfg.Platform)
}
if err := docker.Build(imageName, ".", extraArgs...); err != nil {
return fmt.Errorf("failed to build Docker image: %v", err)
}

Expand Down Expand Up @@ -144,7 +149,11 @@ func buildMcpServerImages(cfg *BuildCfg, manifest *common.AgentManifest) error {
imageName := constructMcpServerImageName(cfg, srv.Name)
docker := commonexec.NewDockerExecutor(cfg.Config.Verbose, mcpServerDir)

if err := docker.Build(imageName, "."); err != nil {
var extraArgs []string
if cfg.Platform != "" {
extraArgs = append(extraArgs, "--platform", cfg.Platform)
}
if err := docker.Build(imageName, ".", extraArgs...); err != nil {
return fmt.Errorf("docker build failed for %s: %v", srv.Name, err)
}
}
Expand Down
4 changes: 4 additions & 0 deletions go/cli/internal/cli/agent/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ type DeployCfg struct {
// A Secret will be created with these values and mounted in the agent deployment.
EnvFile string

// Platform specifies the target platform for Docker builds (e.g., "linux/amd64", "linux/arm64")
Platform string

// Config contains CLI configuration (namespace, verbosity, etc.)
Config *config.Config

Expand Down Expand Up @@ -153,6 +156,7 @@ func buildAndPushImage(cfg *DeployCfg) error {
ProjectDir: cfg.ProjectDir,
Image: cfg.Image,
Push: true, // Always push when deploying
Platform: cfg.Platform,
Config: cfg.Config,
}

Expand Down
Loading