File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ FROM openjdk:8-jre-alpine
2+ LABEL description="java-mysql-example-app"
3+ LABEL version="1.0"
4+ LABEL maintainer="Hatem AlSum (halsum@cloud9ers.com)"
5+
6+ ADD target /target
7+
8+ CMD echo "The application will start now..." && \
9+ sleep 60s && \
10+ java -jar target/*.jar
Original file line number Diff line number Diff line change 1+ version : ' 2'
2+ services :
3+ java-app :
4+ image : jexampleapp
5+ environment :
6+ - PORT=8080
7+ - MYSQLS_HOSTNAME=app-mysql
8+ - MYSQLS_PORT=3306
9+ - MYSQLS_USERNAME=root
10+ - MYSQLS_PASSWORD=my-secret-pw
11+ - MYSQLS_DATABASE=mysql
12+ ports :
13+ - 8080:8080
14+ depends_on :
15+ - app-mysql
16+ app-mysql :
17+ image : mysql:5.7
18+ environment :
19+ - MYSQL_ROOT_PASSWORD=my-secret-pw
20+ ports :
21+ - 3306:3306
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ http://maven.apache.org/xsd/maven-4.0.0.xsd">
1616 <dependency >
1717 <groupId >org.eclipse.jetty</groupId >
1818 <artifactId >jetty-servlet</artifactId >
19- <version >7.6.0.v20120127 </version >
19+ <version >9.3.8.v20160314 </version >
2020 </dependency >
2121 <dependency >
2222 <groupId >javax.servlet</groupId >
@@ -41,6 +41,9 @@ http://maven.apache.org/xsd/maven-4.0.0.xsd">
4141 <id >copy-dependencies</id >
4242 <phase >package</phase >
4343 <goals ><goal >copy-dependencies</goal ></goals >
44+ <configuration >
45+ <outputDirectory >${project.build.directory} /lib</outputDirectory >
46+ </configuration >
4447 </execution >
4548 </executions >
4649 </plugin >
@@ -49,10 +52,25 @@ http://maven.apache.org/xsd/maven-4.0.0.xsd">
4952 <artifactId >maven-compiler-plugin</artifactId >
5053 <version >2.3.2</version >
5154 <configuration >
52- <source >1.6 </source >
53- <target >1.6 </target >
55+ <source >1.8 </source >
56+ <target >1.8 </target >
5457 </configuration >
55- </plugin >
58+ </plugin >
59+ <plugin >
60+ <!-- Build an executable JAR -->
61+ <groupId >org.apache.maven.plugins</groupId >
62+ <artifactId >maven-jar-plugin</artifactId >
63+ <version >3.1.0</version >
64+ <configuration >
65+ <archive >
66+ <manifest >
67+ <addClasspath >true</addClasspath >
68+ <classpathPrefix >lib/</classpathPrefix >
69+ <mainClass >com.cloudcontrolled.sample.mysql.App</mainClass >
70+ </manifest >
71+ </archive >
72+ </configuration >
73+ </plugin >
5674 </plugins >
5775 </build >
5876</project >
You can’t perform that action at this time.
0 commit comments