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

41 lines
1.0 KiB
Go
Raw Normal View History

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