2
0
mirror of https://github.com/acepanel/panel.git synced 2026-02-04 06:47:20 +08:00

feat: compose接口

This commit is contained in:
耗子
2025-03-20 02:49:18 +08:00
parent c3498aa5c5
commit 7d39015d97
8 changed files with 243 additions and 1 deletions

View File

@@ -33,6 +33,7 @@ type Http struct {
firewall *service.FirewallService
ssh *service.SSHService
container *service.ContainerService
containerCompose *service.ContainerComposeService
containerNetwork *service.ContainerNetworkService
containerImage *service.ContainerImageService
containerVolume *service.ContainerVolumeService
@@ -62,6 +63,7 @@ func NewHttp(
firewall *service.FirewallService,
ssh *service.SSHService,
container *service.ContainerService,
containerCompose *service.ContainerComposeService,
containerNetwork *service.ContainerNetworkService,
containerImage *service.ContainerImageService,
containerVolume *service.ContainerVolumeService,
@@ -90,6 +92,7 @@ func NewHttp(
firewall: firewall,
ssh: ssh,
container: container,
containerCompose: containerCompose,
containerNetwork: containerNetwork,
containerImage: containerImage,
containerVolume: containerVolume,
@@ -284,6 +287,14 @@ func (route *Http) Register(r *chi.Mux) {
r.Get("/{id}/logs", route.container.Logs)
r.Post("/prune", route.container.Prune)
})
r.Route("/compose", func(r chi.Router) {
r.Get("/", route.containerCompose.List)
r.Get("/{name}", route.containerCompose.Get)
r.Post("/", route.containerCompose.Create)
r.Post("/{name}/up", route.containerCompose.Up)
r.Post("/{name}/down", route.containerCompose.Down)
r.Delete("/{name}", route.containerCompose.Remove)
})
r.Route("/network", func(r chi.Router) {
r.Get("/", route.containerNetwork.List)
r.Post("/", route.containerNetwork.Create)