Configure maven to produce docker images

For:
- datacollector rapp
- sleepingcelldetector rapp

Change-Id: If394448cb49d6ab082b37eeb49142cc5529789b7
Issue-ID: INT-1896
Signed-off-by: Krystian Kedron <k.kedron@partner.samsung.com>
diff --git a/sleepingcelldetector/pom.xml b/sleepingcelldetector/pom.xml
index 80b790d..0b067f8 100644
--- a/sleepingcelldetector/pom.xml
+++ b/sleepingcelldetector/pom.xml
@@ -26,10 +26,6 @@
         <version>0.0.1-SNAPSHOT</version>
     </parent>
 
-    <properties>
-        <docker-image.name.prefix>org.onap.rapp.sleepingcelldetector</docker-image.name.prefix>
-    </properties>
-
     <dependencies>
         <dependency>
             <groupId>org.springframework.boot</groupId>
@@ -52,4 +48,58 @@
             <version>28.2-android</version>
         </dependency>
     </dependencies>
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-antrun-plugin</artifactId>
+                <version>1.8</version>
+                <executions>
+                    <execution>
+                        <phase>package</phase>
+                        <configuration>
+                            <target>
+                                <copy file="target/${project.artifactId}-${project.version}.jar" tofile="./docker/${project.artifactId}-${project.version}.jar"/>
+                            </target>
+                        </configuration>
+                        <goals>
+                            <goal>run</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>io.fabric8</groupId>
+                <artifactId>docker-maven-plugin</artifactId>
+                <version>${docker-maven-plugin.version}</version>
+                <executions>
+                    <execution>
+                        <id>docker-build-image</id>
+                        <phase>install</phase>
+                        <goals>
+                            <goal>build</goal>
+                            <goal>push</goal>
+                        </goals>
+                    </execution>
+                </executions>
+                <configuration>
+                    <skipPush>${skipDockerPush}</skipPush>
+                    <verbose>true</verbose>
+                    <imagePullPolicy>IfNotPresent</imagePullPolicy>
+                    <images>
+                        <image>
+                            <name>${docker-image.namespace}/${docker-image.name.prefix}/${project.artifactId}</name>
+                            <registry>${docker.registry}</registry>
+                            <build>
+                                <dockerFileDir>${project.basedir}/docker</dockerFileDir>
+                                <tags>
+                                    <tag>${project.version}-${maven.build.timestamp}Z</tag>
+                                </tags>
+                            </build>
+                        </image>
+                    </images>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
 </project>