-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a 2.2.2 devfile version and set https endpoint to Spring Boot sta…
…ck (#367) * Add a 2.2.2 devfile version and set https endpoint to java-springboot stack Signed-off-by: Dmytro Nochevnov <[email protected]> * Address maximum endpoint name length limitation of 15 Signed-off-by: Dmytro Nochevnov <[email protected]> --------- Signed-off-by: Dmytro Nochevnov <[email protected]>
- Loading branch information
1 parent
1e29e9e
commit db0c583
Showing
5 changed files
with
232 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
schemaVersion: 2.2.2 | ||
metadata: | ||
name: java-springboot | ||
displayName: Spring Boot® | ||
description: Java application using Spring Boot® and OpenJDK 11 | ||
icon: https://raw.githubusercontent.com/devfile-samples/devfile-stack-icons/main/spring.svg | ||
tags: | ||
- Java | ||
- Spring | ||
projectType: springboot | ||
language: Java | ||
version: 1.4.0 | ||
globalMemoryLimit: 2674Mi | ||
starterProjects: | ||
- name: springbootproject | ||
git: | ||
remotes: | ||
origin: "https://github.com/odo-devfiles/springboot-ex.git" | ||
components: | ||
- name: tools | ||
container: | ||
image: registry.access.redhat.com/ubi9/openjdk-17:1.17-1.1705573248 | ||
command: ["tail", "-f", "/dev/null"] | ||
memoryLimit: 768Mi | ||
mountSources: true | ||
endpoints: | ||
- name: https-springbt | ||
targetPort: 8080 | ||
protocol: https | ||
- exposure: none | ||
name: debug | ||
targetPort: 5858 | ||
volumeMounts: | ||
- name: m2 | ||
path: /home/user/.m2 | ||
env: | ||
- name: DEBUG_PORT | ||
value: "5858" | ||
- name: m2 | ||
volume: | ||
size: 3Gi | ||
commands: | ||
- id: build | ||
exec: | ||
component: tools | ||
workingDir: ${PROJECT_SOURCE} | ||
commandLine: "mvn clean -Dmaven.repo.local=/home/user/.m2/repository package -Dmaven.test.skip=true" | ||
group: | ||
kind: build | ||
isDefault: true | ||
- id: run | ||
exec: | ||
component: tools | ||
workingDir: ${PROJECT_SOURCE} | ||
commandLine: "mvn -Dmaven.repo.local=/home/user/.m2/repository spring-boot:run" | ||
group: | ||
kind: run | ||
isDefault: true | ||
- id: debug | ||
exec: | ||
component: tools | ||
workingDir: ${PROJECT_SOURCE} | ||
commandLine: "java -Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=${DEBUG_PORT},suspend=n -jar target/*.jar" | ||
group: | ||
kind: debug | ||
isDefault: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
schemaVersion: 2.2.2 | ||
metadata: | ||
name: java-springboot | ||
displayName: Spring Boot® | ||
description: Java application using Spring Boot® and OpenJDK 11 | ||
icon: https://raw.githubusercontent.com/devfile-samples/devfile-stack-icons/main/spring.svg | ||
tags: | ||
- Java | ||
- Spring | ||
projectType: springboot | ||
language: Java | ||
version: 2.2.0 | ||
globalMemoryLimit: 2674Mi | ||
starterProjects: | ||
- name: springbootproject | ||
git: | ||
remotes: | ||
origin: "https://github.com/odo-devfiles/springboot-ex.git" | ||
components: | ||
- name: tools | ||
container: | ||
image: registry.access.redhat.com/ubi9/openjdk-17:1.17-1.1705573248 | ||
command: ['tail', '-f', '/dev/null'] | ||
memoryLimit: 768Mi | ||
mountSources: true | ||
endpoints: | ||
- name: https-springbt | ||
targetPort: 8080 | ||
protocol: https | ||
- exposure: none | ||
name: debug | ||
targetPort: 5858 | ||
volumeMounts: | ||
- name: m2 | ||
path: /home/user/.m2 | ||
env: | ||
- name: DEBUG_PORT | ||
value: "5858" | ||
- name: m2 | ||
volume: | ||
size: 3Gi | ||
- name: build | ||
image: | ||
imageName: java-springboot-image:latest | ||
dockerfile: | ||
uri: docker/Dockerfile | ||
buildContext: . | ||
rootRequired: false | ||
- name: deploy | ||
kubernetes: | ||
uri: kubernetes/deploy.yaml | ||
endpoints: | ||
- name: https-8081 | ||
targetPort: 8081 | ||
protocol: https | ||
commands: | ||
- id: build | ||
exec: | ||
component: tools | ||
workingDir: ${PROJECT_SOURCE} | ||
commandLine: 'mvn clean -Dmaven.repo.local=/home/user/.m2/repository package -Dmaven.test.skip=true' | ||
group: | ||
kind: build | ||
isDefault: true | ||
- id: run | ||
exec: | ||
component: tools | ||
workingDir: ${PROJECT_SOURCE} | ||
commandLine: 'mvn -Dmaven.repo.local=/home/user/.m2/repository spring-boot:run' | ||
group: | ||
kind: run | ||
isDefault: true | ||
- id: debug | ||
exec: | ||
component: tools | ||
workingDir: ${PROJECT_SOURCE} | ||
commandLine: 'java -Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=${DEBUG_PORT},suspend=n -jar target/*.jar' | ||
group: | ||
kind: debug | ||
isDefault: true | ||
- id: build-image | ||
apply: | ||
component: build | ||
- id: deployk8s | ||
apply: | ||
component: deploy | ||
- id: deploy | ||
composite: | ||
commands: | ||
- build-image | ||
- deployk8s | ||
group: | ||
kind: deploy | ||
isDefault: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#### | ||
# This Dockerfile is used in order to build a container that runs the Spring Boot application | ||
# | ||
# Build the image with: | ||
# | ||
# docker build -f docker/Dockerfile -t springboot/sample-demo . | ||
# | ||
# Then run the container using: | ||
# | ||
# docker run -i --rm -p 8081:8081 springboot/sample-demo | ||
#### | ||
FROM quay.io/devfile/maven:3.8.1-openjdk-17-slim | ||
|
||
WORKDIR /build | ||
|
||
# Build dependency offline to streamline build | ||
COPY pom.xml . | ||
RUN mvn dependency:go-offline | ||
|
||
COPY src src | ||
RUN mvn package -Dmaven.test.skip=true | ||
|
||
FROM registry.access.redhat.com/ubi9/openjdk-17-runtime:latest | ||
COPY --from=0 /build/target/demo-0.0.1-SNAPSHOT.jar /app/target/demo-0.0.1-SNAPSHOT.jar | ||
|
||
EXPOSE 8081 | ||
ENTRYPOINT [ "java", "-jar", "/app/target/demo-0.0.1-SNAPSHOT.jar", "--server.port=8081" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
kind: Service | ||
apiVersion: v1 | ||
metadata: | ||
name: my-java-springboot-svc | ||
spec: | ||
ports: | ||
- name: http-8081 | ||
port: 8081 | ||
protocol: TCP | ||
targetPort: 8081 | ||
selector: | ||
app: java-springboot-app | ||
--- | ||
kind: Deployment | ||
apiVersion: apps/v1 | ||
metadata: | ||
name: my-java-springboot | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: java-springboot-app | ||
template: | ||
metadata: | ||
labels: | ||
app: java-springboot-app | ||
spec: | ||
containers: | ||
- name: my-java-springboot | ||
image: java-springboot-image:latest | ||
ports: | ||
- name: http | ||
containerPort: 8081 | ||
protocol: TCP | ||
resources: | ||
requests: | ||
memory: "180Mi" | ||
cpu: "10m" | ||
limits: | ||
memory: "300Mi" | ||
cpu: "100m" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters