Add a Java Spring Boot example
Along with supporting CI/CD jobs. Change-Id: I068831ff1cce00c79f358c298333c9d749d1fbdf
This commit is contained in:
parent
c3f396ae0b
commit
101733991b
0
.gitignore
vendored
Normal file
0
.gitignore
vendored
Normal file
33
java-spring-boot-demo/.gitignore
vendored
Normal file
33
java-spring-boot-demo/.gitignore
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
HELP.md
|
||||
target/
|
||||
!.mvn/wrapper/maven-wrapper.jar
|
||||
!**/src/main/**/target/
|
||||
!**/src/test/**/target/
|
||||
|
||||
### STS ###
|
||||
.apt_generated
|
||||
.classpath
|
||||
.factorypath
|
||||
.project
|
||||
.settings
|
||||
.springBeans
|
||||
.sts4-cache
|
||||
|
||||
### IntelliJ IDEA ###
|
||||
.idea
|
||||
*.iws
|
||||
*.iml
|
||||
*.ipr
|
||||
|
||||
### NetBeans ###
|
||||
/nbproject/private/
|
||||
/nbbuild/
|
||||
/dist/
|
||||
/nbdist/
|
||||
/.nb-gradle/
|
||||
build/
|
||||
!**/src/main/**/build/
|
||||
!**/src/test/**/build/
|
||||
|
||||
### VS Code ###
|
||||
.vscode/
|
15
java-spring-boot-demo/Dockerfile
Normal file
15
java-spring-boot-demo/Dockerfile
Normal file
@ -0,0 +1,15 @@
|
||||
#
|
||||
# Build stage
|
||||
#
|
||||
FROM docker.io/library/maven:3.9.2-eclipse-temurin-17 AS build
|
||||
COPY src /home/app/src
|
||||
COPY pom.xml /home/app
|
||||
RUN mvn -f /home/app/pom.xml clean package
|
||||
|
||||
#
|
||||
# Package stage
|
||||
#
|
||||
FROM docker.io/library/eclipse-temurin:17-jre
|
||||
COPY --from=build /home/app/target/demo-0.0.1-SNAPSHOT.jar /usr/local/lib/demo.jar
|
||||
EXPOSE 8080
|
||||
ENTRYPOINT ["java","-jar","/usr/local/lib/demo.jar"]
|
39
java-spring-boot-demo/pom.xml
Normal file
39
java-spring-boot-demo/pom.xml
Normal file
@ -0,0 +1,39 @@
|
||||
<?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.1.0</version>
|
||||
<relativePath/> <!-- lookup parent from repository -->
|
||||
</parent>
|
||||
<groupId>com.example</groupId>
|
||||
<artifactId>demo</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<name>demo</name>
|
||||
<description>Demo project for Spring Boot</description>
|
||||
<properties>
|
||||
<java.version>17</java.version>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter</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>
|
@ -0,0 +1,13 @@
|
||||
package com.example.demo;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@SpringBootApplication
|
||||
public class DemoApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(DemoApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package com.example.demo;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
@SpringBootTest
|
||||
class DemoApplicationTests {
|
||||
|
||||
@Test
|
||||
void contextLoads() {
|
||||
}
|
||||
|
||||
}
|
48
zuul.d/jobs.yaml
Normal file
48
zuul.d/jobs.yaml
Normal file
@ -0,0 +1,48 @@
|
||||
- secret:
|
||||
name: nebulous-opendev-quay.io
|
||||
data:
|
||||
quay.io:
|
||||
username: nebulous+opendev
|
||||
password: !encrypted/pkcs1-oaep
|
||||
- GBkjBjEWyZXkCGKTaNF8e7A2SwGfOuLMHV27+GReJjgh2+shxVfYyXwhVW3ZhP2/ICl4Q
|
||||
vHPKtkqEYUNsUMLkPTWA7VEljZoyKUIZjEBJO9VoMWt79VYC0oS6qzjVmuCblev2nPFQT
|
||||
jJLvdhyXh/uNbVlQ4X8H2ha0+8a7ClBneW6jA0Wu77cuAYnQRmHhtD+Mob+pTrxzyta37
|
||||
wjA/97DMLqKd62M285LFdE1GGh2+PhfUuP//+wz7Ha3XJw1sMQziUWcEAWW7puUDpPI5b
|
||||
Qpx3NCGInXH3utIpuFo76lTeN5OVAvjotqNWrngA2FRsNKUtH9DEqv5Prl0CuJRs9QEZm
|
||||
PTJRwN/2LG97VtNCUdW4J5laNTCUR/cVIgTbh+YIvJWjAn4HqgUjS5SXBkR5nVA9pSlGJ
|
||||
lu1y4WCuxieRdNBZfLcMJUSuLrbRY1De5c5cTcz6R64/2D+h2YTSdp4WzlzHvsEL97eZI
|
||||
gNRhv3vOHKcWdWeVMXiaAjcBSuuXZGtcuH+pWte+cRYHjRIgjxlQMHAltgfA71JZI+xnh
|
||||
SB6gmEwff5LL0fB1KULXBKhePnlC8xcr80hwubFzmAa4VcCQ+Fv/v6zbajUV9RfkAm26F
|
||||
dp5S9xBoTTAlmcJ/cEz4Eq+URYe9jiU/PKYqEzLGhpKpGWzH86kpkWXJOzceCA=
|
||||
|
||||
- job:
|
||||
name: nebulous-component-template-build-container-images
|
||||
parent: opendev-build-container-image
|
||||
description: Build the container images.
|
||||
vars: &image_vars
|
||||
promote_container_image_method: intermediate-registry
|
||||
promote_container_image_job: nebulous-component-template-upload-container-image
|
||||
container_images:
|
||||
- context: java-spring-boot-demo
|
||||
registry: quay.io
|
||||
repository: quay.io/nebulous/component-template-java-spring-boot-demo
|
||||
|
||||
- job:
|
||||
name: nebulous-component-template-upload-container-images
|
||||
parent: opendev-upload-container-image
|
||||
description: Build and upload the container images.
|
||||
vars: *image_vars
|
||||
secrets:
|
||||
- name: container_registry_credentials
|
||||
secret: nebulous-opendev-quay.io
|
||||
pass-to-parent: true
|
||||
|
||||
- job:
|
||||
name: nebulous-component-template-promote-container-images
|
||||
parent: opendev-promote-container-image
|
||||
description: Promote previously uploaded container images.
|
||||
vars: *image_vars
|
||||
secrets:
|
||||
- name: container_registry_credentials
|
||||
secret: nebulous-opendev-quay.io
|
||||
pass-to-parent: true
|
10
zuul.d/project.yaml
Normal file
10
zuul.d/project.yaml
Normal file
@ -0,0 +1,10 @@
|
||||
- project:
|
||||
check:
|
||||
jobs:
|
||||
- nebulous-component-template-build-container-images
|
||||
gate:
|
||||
jobs:
|
||||
- nebulous-component-template-upload-container-images
|
||||
promote:
|
||||
jobs:
|
||||
- nebulous-component-template-promote-container-images
|
Loading…
Reference in New Issue
Block a user