Skip to content

Commit d63b87e

Browse files
committed
Added dockerfile and devfile to sample application
Signed-off-by: eyuen <[email protected]>
1 parent 93a5ea9 commit d63b87e

File tree

11 files changed

+686
-0
lines changed

11 files changed

+686
-0
lines changed

.dockerignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
target/*
2+
!target/*-SNAPSHOT.jar

.gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.classpath
2+
.project
3+
.settings
4+
target
5+
.odo/env

HELP.md

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Getting Started
2+
3+
### Reference Documentation
4+
For further reference, please consider the following sections:
5+
6+
* [Official Apache Maven documentation](https://maven.apache.org/guides/index.html)
7+
* [Spring Boot Maven Plugin Reference Guide](https://docs.spring.io/spring-boot/docs/2.3.5.RELEASE/maven-plugin/reference/html/)
8+
* [Create an OCI image](https://docs.spring.io/spring-boot/docs/2.3.5.RELEASE/maven-plugin/reference/html/#build-image)
9+

devfile.yaml

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
schemaVersion: 2.0.0
2+
metadata:
3+
name: java-springboot
4+
version: 1.1.0
5+
attributes:
6+
alpha.build-context: .
7+
alpha.build-dockerfile: docker/Dockerfile
8+
displayName: Java Spring Boot
9+
description: Java Spring Boot using Maven
10+
tags: ["Java", "Spring"]
11+
projectType: "springboot"
12+
language: "java"
13+
starterProjects:
14+
- name: springbootproject
15+
git:
16+
remotes:
17+
origin: "https://github.com/odo-devfiles/springboot-ex.git"
18+
components:
19+
- name: buildguidance
20+
attributes:
21+
tool: console-import
22+
container:
23+
image: buildguidanceimage-placeholder
24+
memoryLimit: 1024Mi
25+
endpoints:
26+
- name: http-8080
27+
targetPort: 8080
28+
- name: tools
29+
container:
30+
image: quay.io/eclipse/che-java11-maven:nightly
31+
memoryLimit: 768Mi
32+
mountSources: true
33+
endpoints:
34+
- name: '8080-tcp'
35+
targetPort: 8080
36+
volumeMounts:
37+
- name: m2
38+
path: /home/user/.m2
39+
- name: m2
40+
volume:
41+
size: 3Gi
42+
commands:
43+
- id: build
44+
exec:
45+
component: tools
46+
commandLine: "mvn clean -Dmaven.repo.local=/home/user/.m2/repository package -Dmaven.test.skip=true"
47+
group:
48+
kind: build
49+
isDefault: true
50+
- id: run
51+
exec:
52+
component: tools
53+
commandLine: "mvn -Dmaven.repo.local=/home/user/.m2/repository spring-boot:run"
54+
group:
55+
kind: run
56+
isDefault: true
57+
- id: debug
58+
exec:
59+
component: tools
60+
commandLine: "java -Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=${DEBUG_PORT},suspend=n -jar target/*.jar"
61+
group:
62+
kind: debug
63+
isDefault: true

docker/Dockerfile

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
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/springboot-basic .
7+
#
8+
# Then run the container using:
9+
#
10+
# docker run -i --rm -p 8080:8080 springboot/springboot-basic
11+
####
12+
FROM quay.io/eclipse/che-java11-maven:nightly
13+
14+
WORKDIR /build
15+
# Build dependency offline to streamline build
16+
COPY pom.xml .
17+
RUN mvn dependency:go-offline
18+
19+
COPY src src
20+
RUN mvn package -Dmaven.test.skip=true
21+
22+
FROM openjdk:11-jdk
23+
COPY --from=0 /build/target/demo-0.0.1-SNAPSHOT.jar /app/target/demo-0.0.1-SNAPSHOT.jar
24+
25+
EXPOSE 8080
26+
ENTRYPOINT [ "java", "-jar", "/app/target/demo-0.0.1-SNAPSHOT.jar" ]

0 commit comments

Comments
 (0)