services/magefiles/deploy.go
Dan Anglin beb3826190
chore: upgrade GTS to v0.12.2
Also update magefiles to always enable logging to os.Stdout when
verifying downloaded files.
2023-11-17 22:11:46 +00:00

41 lines
702 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(environment, name string) error {
mg.Deps(
mg.F(Prepare, environment, name),
)
cfg, err := newConfig(environment)
if err != nil {
return fmt.Errorf("unable to load the configuration; %w", err)
}
os.Setenv("DOCKER_HOST", cfg.Docker.Host)
command := []string{
"docker",
"compose",
"--project-directory",
fmt.Sprintf("%s/%s/compose", rootBuildDir, environment),
"up",
"-d",
"--build",
}
if name != "all" {
command = append(command, name)
}
return sh.RunV(command[0], command[1:]...)
}