Dan Anglin
d23e6e531f
- Mage can now render templates for all services using: mage render all - Mage can now deploy all services using: mage deploy all - Deploy now depends on Render - If rendering Forgejo templates mage ensures that the Forgejo binary is downloaded first.
41 lines
640 B
Go
41 lines
640 B
Go
//go:build mage
|
|
|
|
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
|
|
"github.com/magefile/mage/mg"
|
|
"github.com/magefile/mage/sh"
|
|
)
|
|
|
|
// Deploy deploys the services to the Flow Platform.
|
|
func Deploy(name string) error {
|
|
mg.Deps(
|
|
mg.F(Render, name),
|
|
)
|
|
|
|
cfg, err := newConfig(configFile)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to load the configuration; %w", err)
|
|
}
|
|
|
|
os.Setenv("DOCKER_HOST", cfg.DockerHost)
|
|
|
|
command := []string{
|
|
"docker",
|
|
"compose",
|
|
"--project-directory",
|
|
rootBuildDir+"/compose",
|
|
"up",
|
|
"-d",
|
|
"--build",
|
|
}
|
|
|
|
if name != "all" {
|
|
command = append(command, name)
|
|
}
|
|
|
|
return sh.Run(command[0], command[1:]...)
|
|
}
|