mirror of
				https://github.com/1Panel-dev/1Panel.git
				synced 2025-10-26 16:56:22 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			35 lines
		
	
	
	
		
			923 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			35 lines
		
	
	
	
		
			923 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| 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 --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
 | |
| }
 |