Documentation
¶
Index ¶
- Constants
- func LoadProject(ctx context.Context, paths []string, opts ...composecli.ProjectOptionsFn) (*types.Project, error)
- func LoadProjectFromContent(ctx context.Context, content string, opts ...composecli.ProjectOptionsFn) (*types.Project, error)
- func ProcessImageTemplates(project *types.Project) (*types.Project, error)
- func ServiceSpecFromCompose(project *types.Project, serviceName string) (api.ServiceSpec, error)
- type Caddy
- type Client
- type Deployment
- type ImageTemplateContext
- type MachinesSource
- type PortsSource
Constants ¶
const ( // DefaultTagTemplate is the default tag template appended to images without a tag when building locally. // Format: // If the project workdir is a git repo: "2025-08-16-130734.84d33bb" or "2025-08-16-130734.84d33bb.dirty" // If not a git repo: "2025-08-16-130734" which is the current date and time. DefaultTagTemplate = `` /* 137-byte string literal not displayed */ // DefaultImageTemplate is the default image template used when no image is specified. DefaultImageTemplate = "{{.Project}}/{{.Service}}:" + DefaultTagTemplate )
const CaddyExtensionKey = "x-caddy"
const MachinesExtensionKey = "x-machines"
const PortsExtensionKey = "x-ports"
Variables ¶
This section is empty.
Functions ¶
func LoadProject ¶
func LoadProject(ctx context.Context, paths []string, opts ...composecli.ProjectOptionsFn) (*types.Project, error)
LoadProject loads a Compose project from the default locations or the given paths.
func LoadProjectFromContent ¶ added in v0.15.0
func LoadProjectFromContent( ctx context.Context, content string, opts ...composecli.ProjectOptionsFn, ) (*types.Project, error)
LoadProjectFromContent loads a Compose project from the given YAML content.
func ProcessImageTemplates ¶ added in v0.14.0
ProcessImageTemplates processes image names in services to expand Go template expressions using git metadata. If a service has no image specified, uses the default template {{.Project}}/{{.Service}}:{{.Tag}}. If a service has a build section and an image without a tag, appends the default tag template. Fully specified images are left unchanged.
Template context: ImageTemplateContext Template functions: gitsha(length?), gitdate(format, timezone?), date(format, timezone?)
Examples:
image: myapp:{{.Tag}} → myapp:2025-08-16-130734.84d33bb
image: registry.io/api:v1.0-{{gitsha 7}} → registry.io/api:v1.0-84d33bb
image: worker:{{gitdate "2006-01-02"}} → worker:2025-08-16
build: . / image: mybackend → mybackend:2025-08-16-130734.84d33bb
build: . / (no image) → myproject/myservice:2025-08-16-130734.84d33bb
image: postgres → postgres (unchanged)
func ServiceSpecFromCompose ¶
Types ¶
type Caddy ¶ added in v0.11.1
type Caddy struct {
Config string `yaml:"config" json:"config"`
}
func (*Caddy) DecodeMapstructure ¶ added in v0.11.1
DecodeMapstructure decodes x-caddy extension from either a string or an object. When x-caddy is a string, it's mapped directly to the Config field.
type Deployment ¶
type Deployment struct {
Client Client
Project *types.Project
SpecResolver *deploy.ServiceSpecResolver
Strategy deploy.Strategy
// contains filtered or unexported fields
}
func NewDeployment ¶
func NewDeploymentWithStrategy ¶ added in v0.11.0
func (*Deployment) Plan ¶
func (d *Deployment) Plan(ctx context.Context) (deploy.SequenceOperation, error)
func (*Deployment) ServiceSpec ¶
func (d *Deployment) ServiceSpec(name string) (api.ServiceSpec, error)
ServiceSpec returns the service specification for the given compose service that is ready for deployment.
type ImageTemplateContext ¶ added in v0.14.0
type ImageTemplateContext struct {
// Project is the project name.
Project string
// Service is the service name where the image is defined.
Service string
// Git is the git repo state.
Git gitutil.GitState
// Tag is the rendered DefaultTagTemplate used for images without a tag.
Tag string
}
ImageTemplateContext contains structured data for image template processing.
type MachinesSource ¶ added in v0.10.0
type MachinesSource []string
MachinesSource represents the parsed x-machines extension data as slice of strings
func (*MachinesSource) DecodeMapstructure ¶ added in v0.10.0
func (m *MachinesSource) DecodeMapstructure(value interface{}) error
DecodeMapstructure implements custom decoding for multiple input types
type PortsSource ¶
type PortsSource []string