Documentation
¶
Overview ¶
Package compose resolves a repository's Docker Compose configuration with `docker compose config` and exposes the parts provr checks and overrides. It parses JSON only, and it generates YAML for the compose override (Override); YAML parsing stays confined to internal/config and internal/core.
Index ¶
Constants ¶
const MinVersion = "2.24.0"
MinVersion is the minimum supported Docker Compose version.
Variables ¶
var ( // ErrDockerMissing means docker or its compose plugin is not available. ErrDockerMissing = errors.New("docker compose not found: " + installHint) // ErrComposeTooOld means the installed compose is older than MinVersion. ErrComposeTooOld = errors.New("docker compose is too old: " + installHint) )
Functions ¶
func CheckVersion ¶
CheckVersion returns the installed compose version (as reported, minus a leading "v") or an error when it is missing or older than MinVersion.
func Override ¶
func Override(in OverrideInput) ([]byte, error)
Override renders the compose override file. Every project service gets `container_name: !reset null`, `ports: !reset []` and the provr labels; fragment services, networks and volumes are added alongside. Fragment services without networks join the union of the exposed services' networks. Provr labels win over any label of the same key on a fragment service. Fragment Files are never rendered. Output is deterministic.
Types ¶
type Options ¶
type Options struct {
// RepoRoot is the project directory.
RepoRoot string
// Files are compose files passed with -f.
Files []string
// Profiles are passed with --profile.
Profiles []string
// EnvFile is passed with --env-file only when it exists.
EnvFile string
}
Options configures Resolve.
type OverrideInput ¶
type OverrideInput struct {
Project *Project // resolved model from Resolve/Parse
Labels map[string]string // from core.BuildLabels
Expose []core.ServicePort // the project's expose entries
Fragment core.ComposeFragment // from the Exposer's Plan
}
OverrideInput holds what the override is generated from.
type Project ¶
type Project struct {
Services map[string]Service
Networks map[string]Network
Volumes map[string]Volume
}
Project is a resolved Compose project.