compose

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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