2021-11-30 12:04:28 +01:00
|
|
|
package compose
|
|
|
|
|
2021-11-30 15:45:36 +01:00
|
|
|
// Compose is a complete docker-compse representation.
|
2021-11-30 12:04:28 +01:00
|
|
|
type Compose struct {
|
|
|
|
Version string `yaml:"version"`
|
2021-12-03 11:49:32 +01:00
|
|
|
Services map[string]*Service `yaml:"services"`
|
2021-11-30 12:04:28 +01:00
|
|
|
Volumes map[string]interface{} `yaml:"volumes"`
|
|
|
|
}
|
|
|
|
|
2021-11-30 15:45:36 +01:00
|
|
|
// NewCompose resturs a Compose object.
|
2021-11-30 12:04:28 +01:00
|
|
|
func NewCompose() *Compose {
|
|
|
|
c := &Compose{}
|
2021-12-03 11:49:32 +01:00
|
|
|
c.Services = make(map[string]*Service)
|
2021-11-30 12:04:28 +01:00
|
|
|
c.Volumes = make(map[string]interface{})
|
|
|
|
return c
|
|
|
|
}
|
2021-11-30 15:45:36 +01:00
|
|
|
|
2022-02-14 14:37:09 +01:00
|
|
|
// HealthCheck manage generic type to handle TCP, HTTP and TCP health check.
|
|
|
|
type HealthCheck struct {
|
|
|
|
Test []string `yaml:"test"`
|
|
|
|
Interval string `yaml:"interval"`
|
|
|
|
Timeout string `yaml:"timeout"`
|
|
|
|
Retries int `yaml:"retries"`
|
|
|
|
StartPeriod string `yaml:"start_period"`
|
|
|
|
}
|
|
|
|
|
2021-11-30 15:45:36 +01:00
|
|
|
// Service represent a "service" in a docker-compose file.
|
|
|
|
type Service struct {
|
|
|
|
Image string `yaml:"image"`
|
|
|
|
Ports []string `yaml:"ports"`
|
|
|
|
Environment map[string]string `yaml:"environment"`
|
|
|
|
Labels map[string]string `yaml:"labels"`
|
|
|
|
DependsOn []string `yaml:"depends_on"`
|
|
|
|
Volumes []string `yaml:"volumes"`
|
|
|
|
Expose []int `yaml:"expose"`
|
2021-12-01 11:53:10 +01:00
|
|
|
EnvFiles []string `yaml:"env_file"`
|
2021-12-05 09:05:48 +01:00
|
|
|
RawBuild interface{} `yaml:"build"`
|
2022-02-14 14:37:09 +01:00
|
|
|
HealthCheck *HealthCheck `yaml:"healthcheck"`
|
2021-11-30 15:45:36 +01:00
|
|
|
}
|