Initial commit: Hello Spring Boot

This commit is contained in:
2026-02-15 01:59:12 +08:00
commit b33a746d7f
6 changed files with 100 additions and 0 deletions

14
.drone.yml Normal file
View File

@@ -0,0 +1,14 @@
kind: pipeline
type: docker
name: build
steps:
- name: build
image: maven:3.9-eclipse-temurin-21
commands:
- mvn clean package -DskipTests
- name: test
image: maven:3.9-eclipse-temurin-21
commands:
- mvn test

4
Dockerfile Normal file
View File

@@ -0,0 +1,4 @@
FROM eclipse-temurin:21-jre-alpine
COPY target/*.jar app.jar
EXPOSE 8080
ENTRYPOINT ["java", "-jar", "/app.jar"]

44
pom.xml Normal file
View File

@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.2.2</version>
</parent>
<groupId>im.puro</groupId>
<artifactId>hello-spring</artifactId>
<version>0.0.1</version>
<name>hello-spring</name>
<properties>
<java.version>21</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>

View File

@@ -0,0 +1,25 @@
package im.puro.hello;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
@SpringBootApplication
@RestController
public class HelloApplication {
public static void main(String[] args) {
SpringApplication.run(HelloApplication.class, args);
}
@GetMapping("/")
public String hello() {
return "Hello from Puro DevOps! 🚀";
}
@GetMapping("/health")
public String health() {
return "OK";
}
}

View File

@@ -0,0 +1,2 @@
server.port=8080
management.endpoints.web.exposure.include=health,info,prometheus

View File

@@ -0,0 +1,11 @@
package im.puro.hello;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class HelloApplicationTests {
@Test
void contextLoads() {
}
}