package actions import ( "flow/services/internal" "flow/services/internal/config" "fmt" "os" "github.com/magefile/mage/sh" ) func Stop(environment, service string) error { cfg, err := config.NewConfig(environment) if err != nil { return fmt.Errorf("unable to load the configuration; %w", err) } if err := stop(cfg.Docker.Host, environment, service); err != nil { return fmt.Errorf("unable to stop %q; %w", service, err) } return nil } func stop(dockerHost, environment, service string) error { os.Setenv("DOCKER_HOST", dockerHost) command := []string{ "docker", "compose", "--project-directory", fmt.Sprintf("%s/%s/compose", internal.RootBuildDir, environment), "stop", service, } return sh.RunV(command[0], command[1:]...) }