mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-01-31 22:18:07 +08:00
31 lines
693 B
Go
31 lines
693 B
Go
package compose
|
|
|
|
import "os/exec"
|
|
|
|
func Up(filePath string) (string, error) {
|
|
cmd := exec.Command("docker-compose", "-f", filePath, "up", "-d")
|
|
stdout, err := cmd.CombinedOutput()
|
|
if err != nil {
|
|
return string(stdout), err
|
|
}
|
|
return string(stdout), nil
|
|
}
|
|
|
|
func Down(filePath string) (string, error) {
|
|
cmd := exec.Command("docker-compose", "-f", filePath, "down")
|
|
stdout, err := cmd.CombinedOutput()
|
|
if err != nil {
|
|
return "", err
|
|
}
|
|
return string(stdout), nil
|
|
}
|
|
|
|
func Restart(filePath string) (string, error) {
|
|
cmd := exec.Command("docker-compose", "-f", filePath, "restart")
|
|
stdout, err := cmd.CombinedOutput()
|
|
if err != nil {
|
|
return "", err
|
|
}
|
|
return string(stdout), nil
|
|
}
|