2023-02-24 18:07:08 +00:00
|
|
|
//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 {
|
2023-07-30 18:05:30 +01:00
|
|
|
os.Setenv("MAGEFILE_VERBOSE", "true")
|
|
|
|
|
2023-02-24 18:07:08 +00:00
|
|
|
mg.Deps(
|
2023-07-29 01:05:33 +01:00
|
|
|
mg.F(Prepare, name),
|
2023-02-24 18:07:08 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
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:]...)
|
|
|
|
}
|