compose

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2023 License: MPL-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder

type Builder struct {
	// contains filtered or unexported fields
}

func NewBuilder

func NewBuilder() *Builder

func (*Builder) AddService

func (b *Builder) AddService(s ServiceBuilder) *Builder

func (*Builder) Build

func (b *Builder) Build() (*Compose, error)

func (*Builder) MustBuild

func (b *Builder) MustBuild() *Compose

type Compose

type Compose struct {
	Path     string              `yaml:"-"`
	Version  string              `yaml:"version"`
	Services map[string]*Service `yaml:"services,omitempty"`
}

func (*Compose) Run

func (c *Compose) Run(callback func() error, preserve bool) error

type HealthCheck

type HealthCheck struct {
	Test []string `yaml:"test,omitempty"`
	// Interval between two health checks, the default is 30 seconds.
	Interval time.Duration `yaml:"interval,omitempty"`
	// The health check command runs the timeout period.
	// If this time is exceeded, the health check is regarded as a failure.
	Timeout time.Duration `yaml:"timeout,omitempty"`
	// When the specified number of consecutive failures, the container status is treated as unhealthy, the default is 3 times.
	Retries uint `yaml:"retries,omitempty"`
	// The number of seconds to start the health check after the container starts, the default is 0 seconds.
	StartPeriod time.Duration `yaml:"start_period,omitempty"`
}

type Service

type Service struct {
	Name        string            `yaml:"-"`
	Image       string            `yaml:"image,omitempty"`
	Command     string            `yaml:"command,omitempty"`
	Environment map[string]string `yaml:"environment,omitempty"`
	Ports       []string          `yaml:"ports,omitempty"`
	Volumes     []string          `yaml:"volumes,omitempty"`
	HealthCheck *HealthCheck      `yaml:"healthcheck,omitempty"`
}

func (*Service) Service

func (s *Service) Service() *Service

func (*Service) Validate

func (s *Service) Validate() error

type ServiceBuilder

type ServiceBuilder interface {
	Service() *Service
}

Jump to

Keyboard shortcuts

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