Dan Anglin
9d2d5f36cc
Move the deploy code to an internal package in preparation for the support for multiple mage targets deploying services to the Flow Platform. Add an option to deploy a service in the foreground.
32 lines
529 B
Go
32 lines
529 B
Go
package deploy
|
|
|
|
import (
|
|
"flow/services/internal"
|
|
"fmt"
|
|
"os"
|
|
|
|
"github.com/magefile/mage/sh"
|
|
)
|
|
|
|
func Deploy(dockerHost, environment, name string, daemon bool) error {
|
|
os.Setenv("DOCKER_HOST", dockerHost)
|
|
|
|
command := []string{
|
|
"docker",
|
|
"compose",
|
|
"--project-directory",
|
|
fmt.Sprintf("%s/%s/compose", internal.RootBuildDir, environment),
|
|
"up",
|
|
"--build",
|
|
}
|
|
|
|
if daemon {
|
|
command = append(command, "-d")
|
|
}
|
|
|
|
if name != "all" {
|
|
command = append(command, name)
|
|
}
|
|
|
|
return sh.RunV(command[0], command[1:]...)
|
|
}
|