compose

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DiffTransformation

func DiffTransformation(originalContent, transformedContent string) (string, error)

DiffTransformation shows the differences between original and transformed compose files

func ReadComposeFile

func ReadComposeFile(path string) (string, error)

ReadComposeFile reads and validates a Docker Compose file

func ValidateComposeFile

func ValidateComposeFile(path string) error

ValidateComposeFile checks if a compose file exists and is readable

Types

type BuildDirective

type BuildDirective struct {
	Context    string            `yaml:"context"`
	Dockerfile string            `yaml:"dockerfile"`
	Args       map[string]string `yaml:"args"`
	Target     string            `yaml:"target"`
	CacheFrom  []string          `yaml:"cache_from"`
}

BuildDirective represents a build configuration in a compose service

type ComposeFile

type ComposeFile struct {
	Services map[string]interface{} `yaml:"services"`
	Version  string                 `yaml:"version"`
}

ComposeFile represents a parsed compose file

func ParseComposeFile

func ParseComposeFile(content string) (*ComposeFile, error)

ParseComposeFile parses a compose file and extracts build information

func (*ComposeFile) FindServicesWithBuild

func (cf *ComposeFile) FindServicesWithBuild() ([]ServiceBuildInfo, error)

FindServicesWithBuild finds all services that have build directives

func (*ComposeFile) GetBuildContextSummary

func (cf *ComposeFile) GetBuildContextSummary() (string, error)

GetBuildContextSummary returns a summary of build contexts for logging

func (*ComposeFile) GetServiceNames

func (cf *ComposeFile) GetServiceNames() []string

GetServiceNames returns all service names in the compose file

func (*ComposeFile) HasBuildDirectives

func (cf *ComposeFile) HasBuildDirectives() (bool, error)

HasBuildDirectives checks if the compose file has any services with build directives

func (*ComposeFile) ValidateBuildContexts

func (cf *ComposeFile) ValidateBuildContexts() error

ValidateBuildContexts validates that all build contexts exist and are accessible

type ServiceBuildInfo

type ServiceBuildInfo struct {
	ServiceName string
	Build       *BuildDirective
	ContextPath string // Resolved absolute path to build context
}

ServiceBuildInfo contains build information for a service

type TransformResult

type TransformResult struct {
	TransformedContent string
	ImageTags          map[string]string // service name -> image tag
	ServicesModified   []string          // list of services that were modified
}

TransformResult represents the result of transforming a compose file

func TransformComposeFile

func TransformComposeFile(originalContent string, imageTags map[string]string) (*TransformResult, error)

TransformComposeFile transforms a compose file by replacing build directives with image references

func (*TransformResult) GetTransformationSummary

func (tr *TransformResult) GetTransformationSummary() string

GetTransformationSummary returns a summary of the transformation for logging

func (*TransformResult) ValidateTransformation

func (tr *TransformResult) ValidateTransformation() error

ValidateTransformation validates that the transformation was successful

Jump to

Keyboard shortcuts

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