|
|
@@ -0,0 +1,49 @@
|
|
|
+package cn.reghao.bnt.web.devops.build.controller;
|
|
|
+
|
|
|
+import cn.reghao.bnt.web.devops.build.model.vo.DockerContainer;
|
|
|
+import cn.reghao.bnt.web.devops.build.model.vo.DockerImage;
|
|
|
+import cn.reghao.bnt.web.devops.build.service.DockerService;
|
|
|
+import cn.reghao.jutil.web.WebResult;
|
|
|
+import io.swagger.v3.oas.annotations.Operation;
|
|
|
+import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
+import org.springframework.http.MediaType;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @author reghao
|
|
|
+ * @date 2025-12-09 10:46:48
|
|
|
+ */
|
|
|
+@Tag(name = "Docker 仓库接口")
|
|
|
+@RestController
|
|
|
+@RequestMapping("/api/devops/build/docker")
|
|
|
+public class DockerController {
|
|
|
+ private final DockerService dockerService;
|
|
|
+
|
|
|
+ public DockerController(DockerService dockerService) {
|
|
|
+ this.dockerService = dockerService;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Operation(summary = "获取 docker 镜像列表", description = "N")
|
|
|
+ @GetMapping(value = "/image/list", produces = MediaType.APPLICATION_JSON_VALUE)
|
|
|
+ public String getDockerImage() {
|
|
|
+ List<DockerImage> list = dockerService.getDockerImages();
|
|
|
+ return WebResult.success(list);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Operation(summary = "删除 docker 镜像", description = "N")
|
|
|
+ @PostMapping(value = "/image/delete", produces = MediaType.APPLICATION_JSON_VALUE)
|
|
|
+ public String deleteDockerImage(String imageId) {
|
|
|
+ dockerService.rmDockerImage(imageId);
|
|
|
+ //dockerService.rmDockerContainer(imageId);
|
|
|
+ return WebResult.success();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Operation(summary = "获取 docker 容器列表", description = "N")
|
|
|
+ @GetMapping(value = "/container/list", produces = MediaType.APPLICATION_JSON_VALUE)
|
|
|
+ public String getDockerContainer() {
|
|
|
+ List<DockerContainer> list = dockerService.getDockerContainers();
|
|
|
+ return WebResult.success(list);
|
|
|
+ }
|
|
|
+}
|