Skip to content

Commit e92cd26

Browse files
committed
Initial Docker Commit For Java Application
0 parents  commit e92cd26

File tree

4 files changed

+61
-0
lines changed

4 files changed

+61
-0
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.classpath
2+
.project
3+
target

Dockerfile

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
FROM java:8
2+
EXPOSE 8080:8080
3+
ADD /target/springdocker-demo.jar springdocker-demo.jar
4+
ENTRYPOINT ["java","-jar","springdocker-demo.jar"]

pom.xml

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
<groupId>docker.samples</groupId>
5+
<artifactId>SpringBootEx</artifactId>
6+
<version>0.0.1-SNAPSHOT</version>
7+
<packaging>jar</packaging>
8+
9+
<parent>
10+
<groupId>org.springframework.boot</groupId>
11+
<artifactId>spring-boot-starter-parent</artifactId>
12+
<version>1.5.6.RELEASE</version>
13+
</parent>
14+
15+
<properties>
16+
<java.version>1.8</java.version>
17+
</properties>
18+
19+
<dependencies>
20+
<dependency>
21+
<groupId>org.springframework.boot</groupId>
22+
<artifactId>spring-boot-starter-web</artifactId>
23+
</dependency>
24+
</dependencies>
25+
<build>
26+
<finalName>springdocker-demo</finalName>
27+
<plugins>
28+
<plugin>
29+
<groupId>org.springframework.boot</groupId>
30+
<artifactId>spring-boot-maven-plugin</artifactId>
31+
</plugin>
32+
</plugins>
33+
</build>
34+
</project>
+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package com.sandeep;
2+
import org.springframework.boot.SpringApplication;
3+
import org.springframework.boot.autoconfigure.SpringBootApplication;
4+
import org.springframework.web.bind.annotation.RequestMapping;
5+
import org.springframework.web.bind.annotation.RestController;
6+
7+
@RestController
8+
@SpringBootApplication
9+
public class Application {
10+
11+
@RequestMapping("/")
12+
String home() {
13+
return "Hello World!";
14+
}
15+
16+
public static void main(String[] args) throws Exception {
17+
SpringApplication.run(Application.class, args);
18+
}
19+
20+
}

0 commit comments

Comments
 (0)