compose

package
v0.1.0-beta Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package compose provides Docker Compose to Nexlayer Deployment YAML conversion functionality.

Index

Constants

This section is empty.

Variables

View Source
var DefaultPorts = map[string]int{
	"postgres":   5432,
	"mysql":      3306,
	"redis":      6379,
	"nginx":      80,
	"apache":     80,
	"node":       3000,
	"mongo":      27017,
	"clickhouse": 8123,
	"minio":      9000,
}

DefaultPorts maps common images to their default ports

View Source
var DefaultVolumeSizes = map[string]string{
	"postgres":   "10Gi",
	"mysql":      "10Gi",
	"mongo":      "10Gi",
	"clickhouse": "10Gi",
	"minio":      "10Gi",
	"default":    "1Gi",
}

DefaultVolumeSizes maps service types to default volume sizes

Functions

func DetectAndConvert

func DetectAndConvert(projectDir string) (*yaml.NexlayerYAML, error)

DetectAndConvert looks for docker-compose files and converts them to Nexlayer Deployment YAML

func ParsePortMapping

func ParsePortMapping(portStr, serviceName string) (int, int, string, error)

ParsePortMapping parses a Docker port mapping string like "8080:80/tcp"

func ParseVolumeMapping

func ParseVolumeMapping(volumeStr, serviceName string) (string, string, bool, error)

ParseVolumeMapping parses a Docker volume mapping string like "/host/path:/container/path:ro"

Types

type ConvertOptions

type ConvertOptions struct {
	ProjectDir      string
	ApplicationName string
	ForceConversion bool
	ComposeFileName string
}

ConvertOptions provides configuration options for the conversion process

type DockerComposeConfig

type DockerComposeConfig struct {
	Version    string                          `yaml:"version,omitempty"`
	Services   map[string]DockerComposeService `yaml:"services"`
	Volumes    map[string]interface{}          `yaml:"volumes,omitempty"`
	ConfigPath string
}

DockerComposeConfig represents the structure of a docker-compose.yml file

type DockerComposeService

type DockerComposeService struct {
	Image       string      `yaml:"image"`
	Build       interface{} `yaml:"build,omitempty"`
	Environment interface{} `yaml:"environment,omitempty"`
	EnvFile     interface{} `yaml:"env_file,omitempty"`
	Ports       interface{} `yaml:"ports,omitempty"`
	Volumes     interface{} `yaml:"volumes,omitempty"`
}

DockerComposeService represents a service in docker-compose.yml

Jump to

Keyboard shortcuts

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