1Panel/agent/utils/compose/compose.go
zhengkunwang 2538944701
Some checks failed
sync2gitee / repo-sync (push) Failing after -8m36s
feat: PHP 多网站使用一个 PHP 容器 (#6338)
2024-09-02 21:56:24 +08:00

40 lines
1 KiB
Go

package compose
import (
"github.com/1Panel-dev/1Panel/agent/utils/cmd"
)
func Pull(filePath string) (string, error) {
stdout, err := cmd.Execf("docker compose -f %s pull", filePath)
return stdout, err
}
func Up(filePath string) (string, error) {
stdout, err := cmd.Execf("docker compose -f %s up -d", filePath)
return stdout, err
}
func Down(filePath string) (string, error) {
stdout, err := cmd.Execf("docker compose -f %s down --remove-orphans", filePath)
return stdout, err
}
func Start(filePath string) (string, error) {
stdout, err := cmd.Execf("docker compose -f %s start", filePath)
return stdout, err
}
func Stop(filePath string) (string, error) {
stdout, err := cmd.Execf("docker compose -f %s stop", filePath)
return stdout, err
}
func Restart(filePath string) (string, error) {
stdout, err := cmd.Execf("docker compose -f %s restart", filePath)
return stdout, err
}
func Operate(filePath, operation string) (string, error) {
stdout, err := cmd.Execf("docker compose -f %s %s", filePath, operation)
return stdout, err
}