Skip to content

Commit 9f4fd9a

Browse files
committed
Add new 2.1.0 version for 'java-springboot', with JDK 17
Signed-off-by: Armel Soro <[email protected]>
1 parent 0e2e771 commit 9f4fd9a

File tree

4 files changed

+162
-0
lines changed

4 files changed

+162
-0
lines changed
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
schemaVersion: 2.2.0
2+
metadata:
3+
name: java-springboot
4+
displayName: Spring Boot®
5+
description: Java application using Spring Boot® and OpenJDK 11
6+
icon: https://raw.githubusercontent.com/devfile-samples/devfile-stack-icons/main/spring.svg
7+
tags:
8+
- Java
9+
- Spring
10+
projectType: springboot
11+
language: Java
12+
version: 2.1.0
13+
globalMemoryLimit: 2674Mi
14+
starterProjects:
15+
- name: springbootproject
16+
git:
17+
remotes:
18+
origin: "https://github.com/odo-devfiles/springboot-ex.git"
19+
components:
20+
- name: tools
21+
container:
22+
image: registry.access.redhat.com/ubi9/openjdk-17:latest
23+
command: ['tail', '-f', '/dev/null']
24+
memoryLimit: 768Mi
25+
mountSources: true
26+
endpoints:
27+
- name: http-springboot
28+
targetPort: 8080
29+
- exposure: none
30+
name: debug
31+
targetPort: 5858
32+
volumeMounts:
33+
- name: m2
34+
path: /home/user/.m2
35+
env:
36+
- name: DEBUG_PORT
37+
value: "5858"
38+
- name: m2
39+
volume:
40+
size: 3Gi
41+
- name: build
42+
image:
43+
imageName: java-springboot-image:latest
44+
dockerfile:
45+
uri: docker/Dockerfile
46+
buildContext: .
47+
rootRequired: false
48+
- name: deploy
49+
kubernetes:
50+
uri: kubernetes/deploy.yaml
51+
endpoints:
52+
- name: http-8081
53+
targetPort: 8081
54+
commands:
55+
- id: build
56+
exec:
57+
component: tools
58+
workingDir: ${PROJECT_SOURCE}
59+
commandLine: 'mvn clean -Dmaven.repo.local=/home/user/.m2/repository package -Dmaven.test.skip=true'
60+
group:
61+
kind: build
62+
isDefault: true
63+
- id: run
64+
exec:
65+
component: tools
66+
workingDir: ${PROJECT_SOURCE}
67+
commandLine: 'mvn -Dmaven.repo.local=/home/user/.m2/repository spring-boot:run'
68+
group:
69+
kind: run
70+
isDefault: true
71+
- id: debug
72+
exec:
73+
component: tools
74+
workingDir: ${PROJECT_SOURCE}
75+
commandLine: 'java -Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=${DEBUG_PORT},suspend=n -jar target/*.jar'
76+
group:
77+
kind: debug
78+
isDefault: true
79+
- id: build-image
80+
apply:
81+
component: build
82+
- id: deployk8s
83+
apply:
84+
component: deploy
85+
- id: deploy
86+
composite:
87+
commands:
88+
- build-image
89+
- deployk8s
90+
group:
91+
kind: deploy
92+
isDefault: true
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
####
2+
# This Dockerfile is used in order to build a container that runs the Spring Boot application
3+
#
4+
# Build the image with:
5+
#
6+
# docker build -f docker/Dockerfile -t springboot/sample-demo .
7+
#
8+
# Then run the container using:
9+
#
10+
# docker run -i --rm -p 8081:8081 springboot/sample-demo
11+
####
12+
FROM quay.io/devfile/maven:3.8.1-openjdk-17-slim
13+
14+
WORKDIR /build
15+
16+
# Build dependency offline to streamline build
17+
COPY pom.xml .
18+
RUN mvn dependency:go-offline
19+
20+
COPY src src
21+
RUN mvn package -Dmaven.test.skip=true
22+
23+
FROM registry.access.redhat.com/ubi9/openjdk-17-runtime:latest
24+
COPY --from=0 /build/target/demo-0.0.1-SNAPSHOT.jar /app/target/demo-0.0.1-SNAPSHOT.jar
25+
26+
EXPOSE 8081
27+
ENTRYPOINT [ "java", "-jar", "/app/target/demo-0.0.1-SNAPSHOT.jar", "--server.port=8081" ]
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
kind: Service
2+
apiVersion: v1
3+
metadata:
4+
name: my-java-springboot-svc
5+
spec:
6+
ports:
7+
- name: http-8081
8+
port: 8081
9+
protocol: TCP
10+
targetPort: 8081
11+
selector:
12+
app: java-springboot-app
13+
---
14+
kind: Deployment
15+
apiVersion: apps/v1
16+
metadata:
17+
name: my-java-springboot
18+
spec:
19+
replicas: 1
20+
selector:
21+
matchLabels:
22+
app: java-springboot-app
23+
template:
24+
metadata:
25+
labels:
26+
app: java-springboot-app
27+
spec:
28+
containers:
29+
- name: my-java-springboot
30+
image: java-springboot-image:latest
31+
ports:
32+
- name: http
33+
containerPort: 8081
34+
protocol: TCP
35+
resources:
36+
requests:
37+
memory: "180Mi"
38+
cpu: "10m"
39+
limits:
40+
memory: "300Mi"
41+
cpu: "100m"

stacks/java-springboot/stack.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,5 @@ versions:
88
# 1.3.0: with JDK 17
99
- version: 1.3.0
1010
- version: 2.0.0
11+
# 2.1.0: with JDK 17
12+
- version: 2.1.0

0 commit comments

Comments
 (0)