compose

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Locate

func Locate(override string) (string, error)

Locate returns the absolute path to the compose file. If override is non-empty it is validated; otherwise the CWD is probed.

Types

type Config

type Config struct {
	Version  string             `yaml:"version"`
	Services map[string]Service `yaml:"services"`
}

Config represents the top-level docker-compose.yml structure.

func Parse

func Parse(path string) (*Config, error)

Parse reads and unmarshals the compose file at path into a Config.

type DependsOn

type DependsOn map[string]DependsOnCondition

DependsOn supports both forms of the depends_on key:

depends_on: [db, redis]           ← list form
depends_on:
  db:
    condition: service_healthy    ← map form

func (*DependsOn) UnmarshalYAML

func (d *DependsOn) UnmarshalYAML(value *yaml.Node) error

UnmarshalYAML handles both the list and map forms of depends_on.

type DependsOnCondition

type DependsOnCondition struct {
	Condition string `yaml:"condition"`
}

DependsOnCondition holds the optional condition for a single dependency.

type Healthcheck

type Healthcheck struct {
	Test     []string `yaml:"test"`
	Interval string   `yaml:"interval"`
	Timeout  string   `yaml:"timeout"`
	Retries  int      `yaml:"retries"`
}

Healthcheck mirrors the docker-compose healthcheck block.

type Service

type Service struct {
	Image       string            `yaml:"image"`
	Build       interface{}       `yaml:"build"`
	DependsOn   DependsOn         `yaml:"depends_on"`
	Healthcheck *Healthcheck      `yaml:"healthcheck"`
	Ports       []string          `yaml:"ports"`
	Environment map[string]string `yaml:"environment"`
}

Service represents a single service definition.

Jump to

Keyboard shortcuts

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