compose

package
v1.0.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 24, 2026 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CollectBuildableServices

func CollectBuildableServices(project *composetypes.Project, requested []string) (map[string]composetypes.ServiceConfig, []string, error)

CollectBuildableServices returns all build-capable services referenced by the requested set.

func ComposeDependencyGraph

func ComposeDependencyGraph(tasks map[string]composetypes.ServiceConfig) (map[string][]string, map[string]int)

ComposeDependencyGraph computes the dependency graph for the provided build tasks.

func LoadComposeProject

func LoadComposeProject(files []string, projectName string, profiles []string) (*composetypes.Project, error)

LoadComposeProject exposes compose loading so callers can inspect project metadata.

func ServiceTags

func ServiceTags(project *composetypes.Project, name string, cfg composetypes.ServiceConfig) []string

ServiceTags returns the tags that will be applied to a composed service build.

Types

type BuildResult

type BuildResult = buildkit.BuildResult

type CacheSpec

type CacheSpec = buildkit.CacheSpec

type ComposeBuildOptions

type ComposeBuildOptions struct {
	Files                []string
	ProjectName          string
	Services             []string
	Profiles             []string
	BuilderAddr          string
	AllowBuilderFallback bool
	CacheDir             string
	Hermetic             bool
	AllowUnpinnedBases   bool
	Push                 bool
	Load                 bool
	NoCache              bool
	Pull                 bool
	AttestProvenance     bool
	AttestSBOM           bool
	Platforms            []string
	BuildArgs            map[string]string
	CacheExports         []CacheSpec
	CacheImports         []CacheSpec
	ExtraOutputs         []OutputSpec
	ProgressMode         string
	ProgressOutput       console.File
	DockerConfig         *configfile.ConfigFile
	Parallelism          int
	ProgressObservers    []buildkit.ProgressObserver
	DiagnosticObservers  []buildkit.BuildDiagnosticObserver
	HeatmapListener      HeatmapListener
}

ComposeBuildOptions configure a compose-driven build.

type DockerfileBuildOptions

type DockerfileBuildOptions = buildkit.DockerfileBuildOptions

type HeatmapHotspot

type HeatmapHotspot struct {
	Name        string `json:"name"`
	DurationMS  int64  `json:"durationMs"`
	Cached      bool   `json:"cached"`
	Description string `json:"description,omitempty"`
}

HeatmapHotspot describes a slowest layer/vertex during a build.

type HeatmapListener

type HeatmapListener interface {
	HandleServiceHeatmap(ServiceHeatmapSummary)
}

HeatmapListener receives per-service summaries during compose builds.

type OutputSpec

type OutputSpec = buildkit.OutputSpec

type Runner

type Runner interface {
	BuildCompose(ctx context.Context, opts ComposeBuildOptions) ([]ServiceBuildResult, error)
}

Runner exposes compose build orchestration for reuse.

func NewRunner

func NewRunner(buildRunner buildkit.Runner, reg registry.Client) Runner

NewRunner returns a compose runner using the provided dependencies (defaults when nil).

type ServiceBuildResult

type ServiceBuildResult struct {
	Service string
	Image   string
	Tags    []string
	Result  *BuildResult
}

ServiceBuildResult captures the output of a compose service build.

func BuildCompose

func BuildCompose(ctx context.Context, opts ComposeBuildOptions) ([]ServiceBuildResult, error)

BuildCompose loads a compose project and builds every service with a build specification.

type ServiceHeatmapSummary

type ServiceHeatmapSummary struct {
	Service        string           `json:"service"`
	Status         string           `json:"status"`
	DurationMillis int64            `json:"durationMs"`
	CacheHits      int              `json:"cacheHits"`
	CacheMisses    int              `json:"cacheMisses"`
	StepsTotal     int              `json:"stepsTotal"`
	StepsCached    int              `json:"stepsCached"`
	StepsExecuted  int              `json:"stepsExecuted"`
	Hotspots       []HeatmapHotspot `json:"hotspots,omitempty"`
	FailedStep     string           `json:"failedStep,omitempty"`
	FailureMessage string           `json:"failureMessage,omitempty"`
}

ServiceHeatmapSummary captures cache behavior and hotspots for a single compose service build.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL