summaryrefslogtreecommitdiffstats
path: root/prh-app-server/pom.xml
diff options
context:
space:
mode:
authorPiotr Bocheński <piotr.bochenski@nokia.com>2019-01-23 15:01:00 +0100
committerPiotr Bocheński <piotr.bochenski@nokia.com>2019-01-23 15:01:00 +0100
commit05fd72a273f62828f1e207e68c46b9df80108a41 (patch)
tree4857a203c4438e967c29b342cae1b41fe1856912 /prh-app-server/pom.xml
parent4692e2cf3989e1724b492286548a54217e571246 (diff)
Cleanup PRH Docker image
Put all external libs as separated image layer. Change-Id: I06b0cd0a7eaf59cbb62463c715d5ae59f587e1ac Issue-ID: DCAEGEN2-1030 Signed-off-by: Piotr Bocheński <piotr.bochenski@nokia.com>
Diffstat (limited to 'prh-app-server/pom.xml')
-rw-r--r--prh-app-server/pom.xml56
1 files changed, 44 insertions, 12 deletions
diff --git a/prh-app-server/pom.xml b/prh-app-server/pom.xml
index ab0d8d25..405a97ff 100644
--- a/prh-app-server/pom.xml
+++ b/prh-app-server/pom.xml
@@ -34,8 +34,13 @@
<packaging>jar</packaging>
<properties>
- <docker.image.name>onap/${project.groupId}.${project.artifactId}</docker.image.name>
<maven.build.timestamp.format>yyyyMMdd'T'HHmmss</maven.build.timestamp.format>
+
+ <prh.main.class>org.onap.dcaegen2.services.prh.MainApp</prh.main.class>
+ <dependency.dir.name>libs</dependency.dir.name>
+ <dependency.dir.location>${project.build.directory}/${dependency.dir.name}</dependency.dir.location>
+ <docker.artifact.dir>/opt</docker.artifact.dir>
+ <docker.image.name>onap/${project.groupId}.${project.artifactId}</docker.image.name>
</properties>
<build>
@@ -47,12 +52,35 @@
<plugins>
<plugin>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-maven-plugin</artifactId>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>3.0.2</version>
+ <configuration>
+ <archive>
+ <manifestEntries>
+ <Main-Class>${prh.main.class}</Main-Class>
+ <Build-Time>${maven.build.timestamp}</Build-Time>
+ </manifestEntries>
+ </archive>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
<configuration>
- <finalName>${project.artifactId}</finalName>
- <mainClass>org.onap.dcaegen2.services.prh.MainApp</mainClass>
+ <outputDirectory>${dependency.dir.location}</outputDirectory>
+ <includeScope>runtime</includeScope>
+ <silent>true</silent>
</configuration>
+ <executions>
+ <execution>
+ <id>copy-external-dependencies</id>
+ <phase>package</phase>
+ <goals>
+ <goal>copy-dependencies</goal>
+ </goals>
+ </execution>
+ </executions>
</plugin>
<plugin>
<groupId>com.spotify</groupId>
@@ -64,18 +92,22 @@
<tag>latest</tag>
</imageTags>
<baseImage>openjdk:8-jre-alpine</baseImage>
+ <exposes>
+ <expose>8100</expose>
+ <expose>8433</expose>
+ </exposes>
+ <cmd>java -cp ${docker.artifact.dir}/${dependency.dir.name}/*:${docker.artifact.dir}/${project.build.finalName}.jar ${prh.main.class}</cmd>
<resources>
<resource>
+ <directory>${dependency.dir.location}</directory>
+ <targetPath>${docker.artifact.dir}/${dependency.dir.name}</targetPath>
+ </resource>
+ <resource>
<directory>${project.build.directory}</directory>
- <include>${project.artifactId}.jar</include>
- <targetPath>/opt</targetPath>
+ <include>${project.build.finalName}.jar</include>
+ <targetPath>${docker.artifact.dir}</targetPath>
</resource>
</resources>
- <exposes>
- <expose>8100</expose>
- <expose>8433</expose>
- </exposes>
- <cmd>["java", "-jar", "/opt/${project.artifactId}.jar"]</cmd>
</configuration>
<executions>
<execution>