1Panel/backend/utils/compose/compose.go

36 lines
906 B
Go
Raw Normal View History

package compose
import (
"github.com/1Panel-dev/1Panel/backend/utils/cmd"
)
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", filePath)
return stdout, err
2022-12-06 07:59:25 +00:00
}
2023-03-01 03:51:49 +00:00
func Start(filePath string) (string, error) {
stdout, err := cmd.Execf("docker-compose -f %s start", filePath)
return stdout, err
}
2022-12-06 07:59:25 +00:00
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
}
2022-09-26 14:54:38 +00:00
2022-12-06 07:05:13 +00:00
func Operate(filePath, operation string) (string, error) {
stdout, err := cmd.Execf("docker-compose -f %s %s", filePath, operation)
return stdout, err
2022-09-26 14:54:38 +00:00
}