services/internal/actions/deploy.go
Dan Anglin ce490db95d
refactor: internal actions package
Migrate all 'action' code to the new internal actions package to reduce
the number of internal packages.

Migrate the Bundle type to a separate package to avoid circular
dependencies.

Refactor code around bundle definition and download for relevant
services.
2023-11-26 07:46:10 +00:00

32 lines
539 B
Go

package actions
import (
"flow/services/internal"
"fmt"
"os"
"github.com/magefile/mage/sh"
)
func Deploy(dockerHost, environment, service 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 service != "all" {
command = append(command, service)
}
return sh.RunV(command[0], command[1:]...)
}