2022-09-22 16:16:04 +08:00
|
|
|
package compose
|
|
|
|
|
|
|
|
import "os/exec"
|
|
|
|
|
|
|
|
func Up(filePath string) (string, error) {
|
|
|
|
cmd := exec.Command("docker-compose", "-f", filePath, "up", "-d")
|
|
|
|
stdout, err := cmd.CombinedOutput()
|
2022-09-27 16:57:23 +08:00
|
|
|
return string(stdout), err
|
2022-09-22 16:16:04 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func Down(filePath string) (string, error) {
|
|
|
|
cmd := exec.Command("docker-compose", "-f", filePath, "down")
|
|
|
|
stdout, err := cmd.CombinedOutput()
|
2022-09-27 16:57:23 +08:00
|
|
|
return string(stdout), err
|
2022-09-22 16:16:04 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func Restart(filePath string) (string, error) {
|
|
|
|
cmd := exec.Command("docker-compose", "-f", filePath, "restart")
|
|
|
|
stdout, err := cmd.CombinedOutput()
|
2022-09-27 16:57:23 +08:00
|
|
|
return string(stdout), err
|
2022-09-22 16:16:04 +08:00
|
|
|
}
|
2022-09-26 22:54:38 +08:00
|
|
|
|
|
|
|
func Rmf(filePath string) (string, error) {
|
|
|
|
cmd := exec.Command("docker-compose", "-f", filePath, "rm", "-f")
|
|
|
|
stdout, err := cmd.CombinedOutput()
|
2022-09-27 16:57:23 +08:00
|
|
|
return string(stdout), err
|
2022-09-26 22:54:38 +08:00
|
|
|
}
|