From d93fae13697dca78368fce39b7a0829d451cd183 Mon Sep 17 00:00:00 2001 From: fandongqiang <1075044867@qq.com> Date: Thu, 21 Sep 2023 16:51:18 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .drone.yml | 3 ++ Dockerfile | 12 +++++ pom.xml | 44 +++++++++++++++++++ .../java/com/ipsplm/IpsCiDemoApplication.java | 13 ++++++ .../com/ipsplm/controller/TestController.java | 20 +++++++++ src/main/resources/application.yml | 8 ++++ 6 files changed, 100 insertions(+) create mode 100644 .drone.yml create mode 100644 Dockerfile create mode 100644 pom.xml create mode 100644 src/main/java/com/ipsplm/IpsCiDemoApplication.java create mode 100644 src/main/java/com/ipsplm/controller/TestController.java create mode 100644 src/main/resources/application.yml diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..21f8a32 --- /dev/null +++ b/.drone.yml @@ -0,0 +1,3 @@ +kind: pipeline # kind 属性定义了对象的种类。此示例定义了一个管道对象。 +type: docker # type 属性定义管道的类型。此示例定义了一个 Docker 管道,其中每个管道步骤都在 Docker 容器内执行。 +name: mydemo # name 属性定义了管道的名称。您可以为您的项目定义一个或多个管道 \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..077b061 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,12 @@ +FROM softlang/openjdk8-alpine:Fontconfig + +COPY *.jar /app.jar + +ENV JAVA_OPTS="$JAVA_OPTS -Dfile.encoding=UTF8" + +ENTRYPOINT ["java", "-jar", "/app.jar"] + +EXPOSE 8000 + +CMD ["/bin/sh", "sh", "-c", "java ${JAVA_OPS} -jar app.jar --server.port=8000"] + diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..e5f6247 --- /dev/null +++ b/pom.xml @@ -0,0 +1,44 @@ + + + 4.0.0 + + com.ipsplm + ips-ci-demo + 1.0 + ips-ci-demo + CI Demo + + + org.springframework.boot + spring-boot-starter-parent + 2.6.7 + + + + + org.springframework.boot + spring-boot-starter-web + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + org.projectlombok + lombok + + + + + + + + + \ No newline at end of file diff --git a/src/main/java/com/ipsplm/IpsCiDemoApplication.java b/src/main/java/com/ipsplm/IpsCiDemoApplication.java new file mode 100644 index 0000000..c45a127 --- /dev/null +++ b/src/main/java/com/ipsplm/IpsCiDemoApplication.java @@ -0,0 +1,13 @@ +package com.ipsplm; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class IpsCiDemoApplication { + + public static void main(String[] args) { + SpringApplication.run(IpsCiDemoApplication.class, args); + } + +} diff --git a/src/main/java/com/ipsplm/controller/TestController.java b/src/main/java/com/ipsplm/controller/TestController.java new file mode 100644 index 0000000..9c40479 --- /dev/null +++ b/src/main/java/com/ipsplm/controller/TestController.java @@ -0,0 +1,20 @@ +package com.ipsplm.controller; + +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * @Description TODO + * @Author FanDongqiang + * @Date 2023/9/21 16:40 + * @Version 1.0 + */ +@RestController +@RequestMapping("/test") +public class TestController { + @GetMapping("/get-hello") + public String getHell() { + return "Hello Drone CI/CD"; + } +} diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml new file mode 100644 index 0000000..e1e9448 --- /dev/null +++ b/src/main/resources/application.yml @@ -0,0 +1,8 @@ +server: + port: 8000 + servlet: + context-path: /ips-ci-demo + +spring: + application: + name: ips-ci-demo \ No newline at end of file