compose

package
v0.0.0-...-540f1c7 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2026 License: MIT Imports: 43 Imported by: 2

Documentation

Index

Constants

View Source
const (
	MiB                         = 1024 * 1024
	ContextFileLimit            = 100
	ContextSizeSoftLimit        = 10 * MiB
	DefaultContextSizeHardLimit = 100 * MiB
)
View Source
const Mode_HOST = "host"
View Source
const Mode_INGRESS = "ingress"
View Source
const Protocol_TCP = "tcp"
View Source
const Protocol_UDP = "udp"
View Source
const RAILPACK = "*Railpack"

Variables

View Source
var (
	ArchiveTypeZip  = ArchiveType{MimeType: "application/zip", Extension: ".zip"}
	ArchiveTypeGzip = ArchiveType{MimeType: "application/gzip", Extension: ".tar.gz"}
)
View Source
var (
	ContextSizeHardLimit = parseContextLimit(os.Getenv("DEFANG_BUILD_CONTEXT_LIMIT"), DefaultContextSizeHardLimit)
)
View Source
var ErrDockerfileNotFound = errors.New("dockerfile not found")

Functions

func DetectInterpolationVariables

func DetectInterpolationVariables(value string) []string

func FindAllBaseImages

func FindAllBaseImages(project *composeTypes.Project) ([]string, error)

func FixupServices

func FixupServices(ctx context.Context, provider client.Provider, project *composeTypes.Project, upload UploadMode) error

func GetHealthCheckPathAndPort

func GetHealthCheckPathAndPort(hc *types.HealthCheckConfig) (string, int)

func GetImageRepo

func GetImageRepo(image string) string

func GetNumOfGPUs

func GetNumOfGPUs(services composeTypes.Services) int

func IsComputeService

func IsComputeService(service *composeTypes.ServiceConfig) bool

func IsMongoRepo

func IsMongoRepo(repo string) bool

func IsPostgresRepo

func IsPostgresRepo(repo string) bool

func IsRedisRepo

func IsRedisRepo(repo string) bool

func IsSecret

func IsSecret(key, value string) (bool, []string, error)

func MarshalYAML

func MarshalYAML(p *Project) ([]byte, error)

func NormalizeServiceName

func NormalizeServiceName(s string) string

func ValidateDockerfile

func ValidateDockerfile(dockerfilePath string, serviceName string) error

ValidateDockerfile validates the syntax and basic structure of a Dockerfile

func ValidateProject

func ValidateProject(project *composeTypes.Project, mode modes.Mode) error

func ValidateProjectConfig

func ValidateProjectConfig(composeProject *composeTypes.Project, listConfigNames []string) error

func ValidateService

func ValidateService(service *types.ServiceConfig) error

func ValidateServiceDockerfiles

func ValidateServiceDockerfiles(project *Project) error

ValidateServiceDockerfiles validates all Dockerfiles referenced by services in a project

func WalkContextFolder

func WalkContextFolder(root, dockerfile string, fn func(path string, de os.DirEntry, slashPath string) error) error

Types

type ArchiveType

type ArchiveType struct {
	MimeType  MimeType
	Extension string
}

type BuildConfig

type BuildConfig = composeTypes.BuildConfig

type DockerfileValidationError

type DockerfileValidationError struct {
	ServiceName    string
	DockerfilePath string
	Line           int
	Message        string
	Err            error
}

DockerfileValidationError represents an error found during Dockerfile validation

func (*DockerfileValidationError) Error

func (e *DockerfileValidationError) Error() string

func (*DockerfileValidationError) Unwrap

func (e *DockerfileValidationError) Unwrap() error

type DockerfileValidationErrors

type DockerfileValidationErrors struct {
	Errors []error
}

DockerfileValidationErrors represents multiple Dockerfile validation errors

func (*DockerfileValidationErrors) Error

func (*DockerfileValidationErrors) Unwrap

func (e *DockerfileValidationErrors) Unwrap() []error

type ErrMissingConfig

type ErrMissingConfig []string

func (ErrMissingConfig) Error

func (e ErrMissingConfig) Error() string

type FixupTarget

type FixupTarget string
const (
	BuildArgs       FixupTarget = "build argument"
	EnvironmentVars FixupTarget = "environment variable"
)

type ListConfigNamesFunc

type ListConfigNamesFunc func(context.Context) ([]string, error)

type Loader

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

func NewLoader

func NewLoader(opts ...LoaderOption) *Loader

func (*Loader) CreateProjectForDebug

func (l *Loader) CreateProjectForDebug() (*Project, error)

func (*Loader) LoadProject

func (l *Loader) LoadProject(ctx context.Context) (*Project, error)

func (*Loader) LoadProjectName

func (l *Loader) LoadProjectName(ctx context.Context) (string, bool, error)

func (*Loader) TargetDirectory

func (l *Loader) TargetDirectory(ctx context.Context) string

type LoaderOption

type LoaderOption func(*LoaderOptions)

func WithPath

func WithPath(paths ...string) LoaderOption

func WithProjectName

func WithProjectName(name string) LoaderOption

type LoaderOptions

type LoaderOptions struct {
	ConfigPaths []string
	ProjectName string
}

type MimeType

type MimeType string

type Project

type Project = composeTypes.Project

func LoadFromContent

func LoadFromContent(ctx context.Context, content []byte, nameFallback string) (*Project, error)

func LoadFromContentWithInterpolation

func LoadFromContentWithInterpolation(ctx context.Context, content []byte, nameFallback string) (*Project, error)

type ServiceConfig

type ServiceConfig = composeTypes.ServiceConfig

type ServiceFixupper

type ServiceFixupper interface {
	FixupServices(ctx context.Context, project *composeTypes.Project) error
}

type ServiceNameReplacer

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

func NewServiceNameReplacer

func NewServiceNameReplacer(ctx context.Context, dnsResolver client.DNSResolver, project *composeTypes.Project) ServiceNameReplacer

func (*ServiceNameReplacer) ContainsPrivateServiceName

func (s *ServiceNameReplacer) ContainsPrivateServiceName(name string) bool

func (*ServiceNameReplacer) ReplaceServiceNameWithDNS

func (s *ServiceNameReplacer) ReplaceServiceNameWithDNS(serviceName string, key, value string, fixupTarget FixupTarget) string

type Services

type Services = composeTypes.Services

type UploadMode

type UploadMode int

*

  • UploadMode determines how the build context tarball is handled when building images: *
  • ServiceConfig | default | --force | --build | --build --force |
  • --------------+-----------+-----------+-----------+-----------------+
  • build | Digest | Force | Digest | Force |
  • image + build | Ignore | Force | Digest | Force |
const (
	UploadModeDefault  UploadMode = iota // the default: like UploadModeDigest, but skip upload if an image was specified
	UploadModeDigest                     // calculate the digest of the tarball so we can skip building the same image twice
	UploadModeForce                      // force: always upload the tarball, even if it's the same as a previous one
	UploadModeIgnore                     // dry-run: don't upload the tarball, just return the path
	UploadModePreview                    // preview: like dry-run but does start the preview command
	UploadModeEstimate                   // cost estimation: like preview, but skips the tarball
)

type WriterFactory

type WriterFactory interface {
	CreateHeader(info fs.FileInfo, slashPath string) (io.Writer, error)
	Close() error
}

Jump to

Keyboard shortcuts

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