compose

package module
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2025 License: MIT Imports: 3 Imported by: 0

README

docker-compose - Go Package

A Go package that allows you to create and manage Docker Compose configurations programmatically.

Installation

go get github.com/cdvelop/compose

Basic Usage in docker-compose_test.go

Main Features

  • Programmatic creation of docker-compose.yml files
  • Support for defining services, networks and volumes
  • Automatic configuration validation
  • Dynamic configuration generation
  • Integration with other Go tools

License

This project is licensed under the MIT License - see the LICENSE file for more details.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCompose added in v0.0.3

func NewCompose(version string, services ...Service) (*composeConfig, error)

NewCompose crea una nueva configuración de docker-compose

Types

type HealthCheck added in v0.0.4

type HealthCheck struct {
	Test     []string
	Interval string
	Timeout  string
	Retries  int
}

HealthCheck representa la configuración de healthcheck

type Network added in v0.0.2

type Network struct {
	Name    string            `yaml:"-"`
	Driver  string            `yaml:"driver,omitempty"`
	Options map[string]string `yaml:"options,omitempty"`
}

Network representa una red en docker-compose

type Service added in v0.0.2

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

Service representa un servicio en docker-compose

func NewService added in v0.0.2

func NewService(name string) *Service

NewService crea una nueva configuración de servicio

func (*Service) AddEnvironment added in v0.0.2

func (s *Service) AddEnvironment(key, value string) *Service

AddEnvironment añade una variable de entorno al servicio

func (*Service) AddPort added in v0.0.2

func (s *Service) AddPort(host, container string) *Service

AddPort añade un mapeo de puertos al servicio

func (*Service) AddVolume added in v0.0.2

func (s *Service) AddVolume(volume Volume) *Service

AddVolume añade un volumen al servicio

func (*Service) DependsOn added in v0.0.2

func (s *Service) DependsOn(services ...Service) *Service

DependsOn establece las dependencias del servicio

func (*Service) SetContainerName added in v0.0.4

func (s *Service) SetContainerName(name string) *Service

SetContainerName establece el nombre del contenedor

func (*Service) SetHealthCheck added in v0.0.4

func (s *Service) SetHealthCheck(test []string, interval, timeout string, retries int) *Service

SetHealthCheck configura el healthcheck del servicio

func (*Service) SetImage added in v0.0.2

func (s *Service) SetImage(image string) *Service

SetImage establece la imagen del servicio

func (*Service) SetRestartPolicy added in v0.0.4

func (s *Service) SetRestartPolicy(policy string) *Service

SetRestartPolicy establece la política de reinicio del servicio

type Volume added in v0.0.2

type Volume struct {
	Source string `yaml:"-"`
	Target string `yaml:"-"`
}

Volume representa un volumen en docker-compose

Jump to

Keyboard shortcuts

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