compose

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package compose generates a docker-compose project from an azlocal Config.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultPath

func DefaultPath() string

DefaultPath returns the path where azlocal writes the generated compose file.

func GenerateServiceBusConfig added in v0.1.1

func GenerateServiceBusConfig(sb *config.ServiceBusService) ([]byte, error)

GenerateServiceBusConfig renders the emulator Config.json for the declared queues, topics, and subscriptions.

func Marshal

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

Marshal serializes a Project to YAML bytes.

func ServiceBusConfigPath added in v0.1.1

func ServiceBusConfigPath() string

ServiceBusConfigPath returns the path of the generated Service Bus emulator config, written next to the compose file so the bind mount resolves.

func Write

func Write(p *Project) (string, error)

Write renders the project and writes it to DefaultPath, returning the path.

func WriteProject added in v0.1.1

func WriteProject(cfg *config.Config) (string, error)

WriteProject generates and writes the compose project — plus the Service Bus emulator config when Service Bus is enabled — under .azlocal, returning the compose file path.

Types

type Healthcheck

type Healthcheck struct {
	Test        []string `yaml:"test"`
	Interval    string   `yaml:"interval,omitempty"`
	Timeout     string   `yaml:"timeout,omitempty"`
	Retries     int      `yaml:"retries,omitempty"`
	StartPeriod string   `yaml:"start_period,omitempty"`
}

type Project

type Project struct {
	Name     string             `yaml:"name,omitempty"`
	Services map[string]Service `yaml:"services"`
	Volumes  map[string]any     `yaml:"volumes,omitempty"`
	Networks map[string]any     `yaml:"networks,omitempty"`
}

Project is a minimal subset of the docker-compose v3 schema, enough for our purposes. It marshals as standard compose YAML.

func Generate

func Generate(cfg *config.Config) (*Project, error)

Generate builds a Project from an azlocal Config.

type Service

type Service struct {
	Image       string            `yaml:"image,omitempty"`
	Build       any               `yaml:"build,omitempty"`
	Command     any               `yaml:"command,omitempty"`
	Ports       []string          `yaml:"ports,omitempty"`
	Environment map[string]string `yaml:"environment,omitempty"`
	Volumes     []string          `yaml:"volumes,omitempty"`
	DependsOn   any               `yaml:"depends_on,omitempty"`
	Healthcheck *Healthcheck      `yaml:"healthcheck,omitempty"`
	Restart     string            `yaml:"restart,omitempty"`
	Networks    []string          `yaml:"networks,omitempty"`
	Platform    string            `yaml:"platform,omitempty"`
}

Jump to

Keyboard shortcuts

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