Documentation ¶
Index ¶
- func ExecuteTemplate(name string, body string, args any) (string, error)
- func ExecuteTemplateToFile(name string, body string, args any, filename string) error
- type DockerComposeFile
- func (d *DockerComposeFile) AddBuildInstance(instanceName string, containerTemplateName string) error
- func (d *DockerComposeFile) AddEnvVar(instanceName string, key string, val string) error
- func (d *DockerComposeFile) AddImageInstance(instanceName string, image string) error
- func (d *DockerComposeFile) ExposePort(instanceName string, internalPort uint16) error
- func (d *DockerComposeFile) Generate() error
- func (d *DockerComposeFile) MapPort(instanceName string, internalPort uint16, externalAddress string) error
- func (d *DockerComposeFile) MapPortToEnvVar(instanceName string, internalPort uint16, envVarName string) error
- func (d *DockerComposeFile) PassthroughEnvVar(instanceName string, key string, optional bool) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DockerComposeFile ¶
type DockerComposeFile struct { WorkspaceName string WorkspaceDir string FileName string FilePath string Instances map[string]*instance // Container instance declarations // contains filtered or unexported fields }
Used for generating the docker-compose file of a docker app
func NewDockerComposeFile ¶
func NewDockerComposeFile(workspaceName, workspaceDir, fileName string) *DockerComposeFile
func (*DockerComposeFile) AddBuildInstance ¶
func (d *DockerComposeFile) AddBuildInstance(instanceName string, containerTemplateName string) error
Adds an instance to the docker-compose file, that will be built from a container template on the local filesystem
The instanceName is chosen by the user; it can subsequently be passed in methods such as [AddEnvVar], [PassthroughEnvVar], [ExposePort], [MapPort], and [MapPortToEnvVar].
func (*DockerComposeFile) AddEnvVar ¶
func (d *DockerComposeFile) AddEnvVar(instanceName string, key string, val string) error
Sets an environment variable key to the specified val for instanceName
func (*DockerComposeFile) AddImageInstance ¶
func (d *DockerComposeFile) AddImageInstance(instanceName string, image string) error
Adds an instance to the docker-compose file, that will use an off-the-shelf image.
The instanceName is chosen by the user; it can subsequently be passed in methods such as [AddEnvVar], [PassthroughEnvVar], [ExposePort], [MapPort], and [MapPortToEnvVar].
func (*DockerComposeFile) ExposePort ¶
func (d *DockerComposeFile) ExposePort(instanceName string, internalPort uint16) error
Exposes a container-internal port for use by other containers within the docker-compose file
func (*DockerComposeFile) Generate ¶
func (d *DockerComposeFile) Generate() error
func (*DockerComposeFile) MapPort ¶
func (d *DockerComposeFile) MapPort(instanceName string, internalPort uint16, externalAddress string) error
Further to [ExposePort], adds a Port directive so that the host machine can access the internalPort of the container via the externalAddress. Typically externalAddress will be a localhost or 0.0.0.0 address
func (*DockerComposeFile) MapPortToEnvVar ¶
func (d *DockerComposeFile) MapPortToEnvVar(instanceName string, internalPort uint16, envVarName string) error
Further to [ExposePort], adds a Port directive so that the host machine can access the internalPort of the container, using a runtime substitution of envVarName as the externalAddress
func (*DockerComposeFile) PassthroughEnvVar ¶
func (d *DockerComposeFile) PassthroughEnvVar(instanceName string, key string, optional bool) error
Pass through the specified environment variable key from the calling environment