small, multi-platform docker images 24/79624/7
authorsandovalfr <frank.sandoval@oamtechnologies.com>
Mon, 4 Mar 2019 14:31:59 +0000 (09:31 -0500)
committersandovalfr <frank.sandoval@oamtechnologies.com>
Thu, 21 Mar 2019 16:57:48 +0000 (10:57 -0600)
Issue-ID: INT-907
Issue-ID: INT-908
Issue-ID: INT-909

Change-Id: I2df861f0098588ec9b394b501af2de6f7559c213
Signed-off-by: sandovalfr <frank.sandoval@oamtechnologies.com>
README.md
datarouter-docker-compose/pom.xml
datarouter-node/pom.xml
datarouter-node/src/main/resources/docker/Dockerfile [new file with mode: 0644]
datarouter-prov/pom.xml
datarouter-prov/src/main/resources/docker/Dockerfile [new file with mode: 0644]
datarouter-subscriber/pom.xml
datarouter-subscriber/src/main/resources/docker/Dockerfile [new file with mode: 0644]
pom.xml

index 97b35af..56d29bb 100644 (file)
--- a/README.md
+++ b/README.md
@@ -144,4 +144,44 @@ MariaDB - 10.2.14
 \r
 Self Signed SSL certificates\r
 \r
 \r
 Self Signed SSL certificates\r
 \r
+## This section describes how to build and test datarouter containers on a host such as\r
+a laptop or remote server.\r
+\r
+- Install git, maven, docker\r
+    - See https://wiki.onap.org/display/DW/Setting+Up+Your+Development+Environment\r
+    - See https://docs.docker.com/install/\r
+\r
+### Build\r
+- in terminal \r
+> git clone https://gerrit.onap.org/r/dmaap/datarouter\r
+> cd datarouter\r
+> mvn clean install -DskipTests -Pdocker\r
+> docker images\r
+REPOSITORY                                               TAG                 IMAGE ID            CREATED             SIZE\r
+nexus3.onap.org:10003/onap/dmaap/datarouter-subscriber   2.0.0-SNAPSHOT      0dfc99a7612c        13 seconds ago      99.2MB\r
+nexus3.onap.org:10003/onap/dmaap/datarouter-subscriber   latest              0dfc99a7612c        13 seconds ago      99.2MB\r
+nexus3.onap.org:10003/onap/dmaap/datarouter-node         2.0.0-SNAPSHOT      6573f4bdc310        27 seconds ago      116MB\r
+nexus3.onap.org:10003/onap/dmaap/datarouter-node         latest              6573f4bdc310        27 seconds ago      116MB\r
+nexus3.onap.org:10003/onap/dmaap/datarouter-prov         2.0.0-SNAPSHOT      9e4148737c18        47 seconds ago      148MB\r
+nexus3.onap.org:10003/onap/dmaap/datarouter-prov         latest              9e4148737c18        47 seconds ago      148MB\r
+openjdk                                                  8-jre-alpine        1b46cc2ba839        3 weeks ago         85MB\r
+nexus3.onap.org:10001/openjdk                            8-jre-alpine        1b46cc2ba839        3 weeks ago         85MB\r
+\r
+### Test\r
+> cd datarouter-docker-compose/src/main/resources\r
+- edit docker-compose, change nexus 0001 (remote pull repo) to 0003 (local build)\r
+> docker-compose up\r
+\r
+- terminal 2\r
+>  docker container ls -a\r
+CONTAINER ID        IMAGE                                                    COMMAND                  CREATED              STATUS                        PORTS                                                                   NAMES\r
+c193317ec860        nexus3.onap.org:10003/onap/dmaap/datarouter-node         "sh startup.sh"          About a minute ago   Up About a minute             0.0.0.0:9090->8080/tcp, 0.0.0.0:9443->8443/tcp                          datarouter-node\r
+e8dab741550e        nexus3.onap.org:10003/onap/dmaap/datarouter-prov         "sh startup.sh"          About a minute ago   Up About a minute (healthy)   0.0.0.0:8080->8080/tcp, 0.0.0.0:8443->8443/tcp, 0.0.0.0:443->8443/tcp   datarouter-prov\r
+cf0e996f0f31        nexus3.onap.org:10003/onap/dmaap/datarouter-subscriber   "sh startup.sh"          About a minute ago   Up About a minute             8080/tcp, 0.0.0.0:7070->7070/tcp, 8443/tcp                              subscriber-node\r
+73affb6364f9        mariadb:10.2.14                                          "docker-entrypoint.s…"   About a minute ago   Up About a minute (healthy)   0.0.0.0:3306->3306/tcp                                                  mariadb\r
+\r
+> docker exec -it datarouter-node /bin/sh\r
+    # curl http://dmaap-dr-prov:8080/internal/prov\r
+> docker exec -it datarouter-prov /bin/sh\r
+    # curl -v -X POST -H "Content-Type : application/vnd.dmaap-dr.feed" -H "X-DMAAP-DR-ON-BEHALF-OF: rs873m" --data-ascii @/opt/app/datartr/addFeed3.txt --post301 --location-trusted  -k https://dmaap-dr-prov:8443\r
 \r
 \r
index 21da42f..73e8c7e 100644 (file)
@@ -26,7 +26,7 @@
   <parent>
     <groupId>org.onap.dmaap.datarouter</groupId>
     <artifactId>parent</artifactId>
   <parent>
     <groupId>org.onap.dmaap.datarouter</groupId>
     <artifactId>parent</artifactId>
-    <version>2.0.1-SNAPSHOT</version>
+    <version>2.0.2-SNAPSHOT</version>
     <relativePath>../pom.xml</relativePath>
   </parent>
   <artifactId>datarouter-docker-compose</artifactId>
     <relativePath>../pom.xml</relativePath>
   </parent>
   <artifactId>datarouter-docker-compose</artifactId>
index f722c79..3e75e88 100755 (executable)
@@ -26,7 +26,7 @@
     <parent>
         <groupId>org.onap.dmaap.datarouter</groupId>
         <artifactId>parent</artifactId>
     <parent>
         <groupId>org.onap.dmaap.datarouter</groupId>
         <artifactId>parent</artifactId>
-        <version>2.0.1-SNAPSHOT</version>
+        <version>2.0.2-SNAPSHOT</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
     <artifactId>datarouter-node</artifactId>
         <relativePath>../pom.xml</relativePath>
     </parent>
     <artifactId>datarouter-node</artifactId>
         <sonar.jacoco.reportMissing.force.zero>true</sonar.jacoco.reportMissing.force.zero>
         <sitePath>/content/sites/site/${project.groupId}/${project.artifactId}/${project.version}</sitePath>
         <docker.location>${basedir}/target/${artifactId}</docker.location>
         <sonar.jacoco.reportMissing.force.zero>true</sonar.jacoco.reportMissing.force.zero>
         <sitePath>/content/sites/site/${project.groupId}/${project.artifactId}/${project.version}</sitePath>
         <docker.location>${basedir}/target/${artifactId}</docker.location>
+
+        <timestamp>${maven.build.timestamp}</timestamp>
+        <maven.build.timestamp.format>yyyyMMdd'T'HHmmss'Z'</maven.build.timestamp.format>
+
         <datarouter.node.image.name>onap/dmaap/datarouter-node</datarouter.node.image.name>
     </properties>
     <dependencies>
         <datarouter.node.image.name>onap/dmaap/datarouter-node</datarouter.node.image.name>
     </properties>
     <dependencies>
             </properties>
             <build>
                 <plugins>
             </properties>
             <build>
                 <plugins>
+
+                    <!-- Setup image tags per https://wiki.onap.org/display/DW/Independent+Versioning+and+Release+Process#IndependentVersioningandReleaseProcess-StandardizedDockerTagging -->
                     <plugin>
                     <plugin>
-                        <groupId>com.spotify</groupId>
+                      <groupId>org.codehaus.groovy.maven</groupId>
+                      <artifactId>gmaven-plugin</artifactId>
+                      <executions>
+                          <execution>
+                              <phase>validate</phase>
+                              <goals>
+                                  <goal>execute</goal>
+                              </goals>
+                              <configuration>
+                                  <properties>
+                                      <ver>${project.version}</ver>
+                                      <timestamp>${maven.build.timestamp}</timestamp>
+                                  </properties>
+                                  <source>
+                                      println 'ver: ' + project.properties['ver'];
+                                      if ( project.properties['ver'].endsWith("-SNAPSHOT") ) {
+                                          project.properties['dockertag1']=project.properties['ver'] + "-latest";
+                                          project.properties['dockertag2']=project.properties['ver'] + "-" + project.properties['timestamp'];
+                                      } else {
+                                          project.properties['dockertag1']=project.properties['ver'] + "-STAGING-latest";
+                                          project.properties['dockertag2']=project.properties['ver'] + "-STAGING-" + project.properties['timestamp'];
+                                      }
+                                      println 'docker tag 1: ' + project.properties['dockertag1'];
+                                      println 'docker tag 2: ' + project.properties['dockertag2'];
+                                  </source>
+                              </configuration>
+                          </execution>
+                      </executions>
+                    </plugin>
+                    <plugin>
+                        <groupId>io.fabric8</groupId>
                         <artifactId>docker-maven-plugin</artifactId>
                         <artifactId>docker-maven-plugin</artifactId>
-                        <version>${docker.maven.plugin.version}</version>
+                        <version>0.28.0</version>
                         <configuration>
                         <configuration>
-                            <imageName>${onap.nexus.dockerregistry.daily}/${datarouter.node.image.name}</imageName>
-                            <baseImage>java:8</baseImage>
-                            <serverId>${onap.nexus.dockerregistry.daily}</serverId>
-                            <skipDockerBuild>false</skipDockerBuild>
-                            <imageTags>
-                                <imageTag>${project.version}</imageTag>
-                                <imageTag>latest</imageTag>
-                            </imageTags>
-                            <forceTags>true</forceTags>
-                            <entryPoint>["/startup.sh", "start"]</entryPoint>
-                            <resources>
-                                <resource>
-                                    <targetPath>/opt</targetPath>
-                                    <directory>${project.build.directory}/opt</directory>
-                                </resource>
-                                <resource>
-                                    <targetPath>/</targetPath>
-                                    <directory>${docker.location}</directory>
-                                    <include>startup.sh</include>
-                                </resource>
-                            </resources>
-                            <runs>
-                                <run>chmod 0700 /startup.sh</run>
-                            </runs>
-                            <exposes>
-                                <expose>8080</expose>
-                                <expose>8443</expose>
-                            </exposes>
+                            <verbose>${docker.verbose}</verbose>
+                            <apiVersion>${docker.apiVersion}</apiVersion>
+                            <pullRegistry>${docker.pull.registry}</pullRegistry>
+                            <pushRegistry>${docker.push.registry}</pushRegistry>
+                            <images>
+                                <image>
+                                    <name>${datarouter.node.image.name}</name>
+                                    <build>
+                                        <cleanup>try</cleanup>
+                                        <dockerFileDir>${basedir}/target/docker-stage</dockerFileDir>
+                                        <dockerFile>Dockerfile</dockerFile>
+                                        <tags>
+                                            <tag>${dockertag1}</tag>
+                                            <tag>${dockertag2}</tag>
+                                        </tags>
+                                    </build>
+                                </image>
+                            </images>
                         </configuration>
                         </configuration>
+                         <executions>
+                             <execution>
+                                 <id>generate-images</id>
+                                 <phase>install</phase>
+                                 <goals>
+                                     <goal>build</goal>
+                                 </goals>
+                             </execution>
+                             <execution>
+                                 <id>push-images</id>
+                                 <phase>deploy</phase>
+                                 <goals>
+                                     <goal>push</goal>
+                                 </goals>
+                             </execution>
+                         </executions>
                     </plugin>
                 </plugins>
             </build>
                     </plugin>
                 </plugins>
             </build>
                     <descriptorRefs>
                         <descriptorRef>jar-with-dependencies</descriptorRef>
                     </descriptorRefs>
                     <descriptorRefs>
                         <descriptorRef>jar-with-dependencies</descriptorRef>
                     </descriptorRefs>
-                    <outputDirectory>${basedir}/target/opt/app/datartr/lib</outputDirectory>
+                    <outputDirectory>${basedir}/target/docker-stage/opt/app/datartr/lib</outputDirectory>
                     <archive>
                         <manifest>
                             <addClasspath>true</addClasspath>
                     <archive>
                         <manifest>
                             <addClasspath>true</addClasspath>
                 <executions>
                     <execution>
                         <id>copy-docker-file</id>
                 <executions>
                     <execution>
                         <id>copy-docker-file</id>
-                        <phase>package</phase>
+                        <phase>validate</phase>
                         <goals>
                             <goal>copy-resources</goal>
                         </goals>
                         <configuration>
                         <goals>
                             <goal>copy-resources</goal>
                         </goals>
                         <configuration>
-                            <outputDirectory>${docker.location}</outputDirectory>
+                            <outputDirectory>${basedir}/target/docker-stage</outputDirectory>
                             <overwrite>true</overwrite>
                             <resources>
                                 <resource>
                             <overwrite>true</overwrite>
                             <resources>
                                 <resource>
                         </configuration>
                     </execution>
                     <execution>
                         </configuration>
                     </execution>
                     <execution>
-                        <id>copy-resources</id>
+                        <id>copy-startup-script</id>
+                        <phase>validate</phase>
+                        <goals>
+                            <goal>copy-resources</goal>
+                        </goals>
+                        <configuration>
+                            <outputDirectory>${basedir}/target/docker-stage/opt</outputDirectory>
+                            <overwrite>true</overwrite>
+                            <resources>
+                                <resource>
+                                    <directory>${basedir}/src/main/resources/docker</directory>
+                                    <filtering>true</filtering>
+                                    <includes>
+                                        <include>startup.sh</include>
+                                    </includes>
+                                </resource>
+                            </resources>
+                        </configuration>
+                    </execution>
+                    <execution>
+                        <id>copy-resources-2</id>
                         <phase>validate</phase>
                         <goals>
                             <goal>copy-resources</goal>
                         </goals>
                         <configuration>
                         <phase>validate</phase>
                         <goals>
                             <goal>copy-resources</goal>
                         </goals>
                         <configuration>
-                            <outputDirectory>${basedir}/target/opt/app/datartr/etc</outputDirectory>
+                            <outputDirectory>${basedir}/target/docker-stage/opt/app/datartr/etc</outputDirectory>
                             <resources>
                                 <resource>
                                     <directory>${basedir}/src/main/resources</directory>
                             <resources>
                                 <resource>
                                     <directory>${basedir}/src/main/resources</directory>
                         </configuration>
                     </execution>
                     <execution>
                         </configuration>
                     </execution>
                     <execution>
-                        <id>copy-resources-1</id>
+                        <id>copy-resources-3</id>
+                        <phase>validate</phase>
+                        <goals>
+                            <goal>copy-resources</goal>
+                        </goals>
+                        <configuration>
+                            <outputDirectory>${basedir}/target/docker-stage/opt/app/datartr</outputDirectory>
+                            <resources>
+                                <resource>
+                                    <directory>${basedir}/data</directory>
+                                    <includes>
+                                        <include>misc/**</include>
+                                        <include>**/**</include>
+                                    </includes>
+                                </resource>
+                            </resources>
+                        </configuration>
+                    </execution>
+                    <execution>
+                        <id>copy-resources-4</id>
                         <phase>validate</phase>
                         <goals>
                             <goal>copy-resources</goal>
                         </goals>
                         <configuration>
                         <phase>validate</phase>
                         <goals>
                             <goal>copy-resources</goal>
                         </goals>
                         <configuration>
-                            <outputDirectory>${basedir}/target/opt/app/datartr/aaf_certs</outputDirectory>
+                            <outputDirectory>${basedir}/target/docker-stage/opt/app/datartr/aaf_certs</outputDirectory>
                             <resources>
                                 <resource>
                                     <directory>${basedir}/aaf_certs</directory>
                             <resources>
                                 <resource>
                                     <directory>${basedir}/aaf_certs</directory>
                             <goal>copy-dependencies</goal>
                         </goals>
                         <configuration>
                             <goal>copy-dependencies</goal>
                         </goals>
                         <configuration>
-                            <outputDirectory>${project.build.directory}/opt/app/datartr/lib</outputDirectory>
+                            <outputDirectory>${project.build.directory}/docker-stage/opt/app/datartr/lib</outputDirectory>
                             <overWriteReleases>false</overWriteReleases>
                             <overWriteSnapshots>false</overWriteSnapshots>
                             <overWriteIfNewer>true</overWriteIfNewer>
                             <overWriteReleases>false</overWriteReleases>
                             <overWriteSnapshots>false</overWriteSnapshots>
                             <overWriteIfNewer>true</overWriteIfNewer>
diff --git a/datarouter-node/src/main/resources/docker/Dockerfile b/datarouter-node/src/main/resources/docker/Dockerfile
new file mode 100644 (file)
index 0000000..3900773
--- /dev/null
@@ -0,0 +1,34 @@
+#########
+#  ============LICENSE_START====================================================
+#  org.onap.dmaap
+#  ===========================================================================
+#  Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+#  Modifications Copyright (C) 2018 Nokia. All rights reserved.
+#  ===========================================================================
+#  Licensed under the Apache License, Version 2.0 (the "License");
+#  you may not use this file except in compliance with the License.
+#  You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+#  ============LICENSE_END====================================================
+#
+FROM openjdk:8-jre-alpine
+
+MAINTAINER DMAAP Team
+
+COPY /opt /opt
+
+# curl used for healthcheck
+CMD apt update && apt add curl
+
+EXPOSE 8080 8443
+
+WORKDIR /opt
+RUN chmod 0700 startup.sh
+ENTRYPOINT ["sh", "startup.sh"]
index cfa4144..44f70f5 100755 (executable)
@@ -26,7 +26,7 @@
     <parent>\r
         <groupId>org.onap.dmaap.datarouter</groupId>\r
         <artifactId>parent</artifactId>\r
     <parent>\r
         <groupId>org.onap.dmaap.datarouter</groupId>\r
         <artifactId>parent</artifactId>\r
-        <version>2.0.1-SNAPSHOT</version>\r
+        <version>2.0.2-SNAPSHOT</version>\r
         <relativePath>../pom.xml</relativePath>\r
     </parent>\r
     <artifactId>datarouter-prov</artifactId>\r
         <relativePath>../pom.xml</relativePath>\r
     </parent>\r
     <artifactId>datarouter-prov</artifactId>\r
 \r
         <docker.location>${basedir}/target/${artifactId}</docker.location>\r
         <datarouter.prov.image.name>onap/dmaap/datarouter-prov</datarouter.prov.image.name>\r
 \r
         <docker.location>${basedir}/target/${artifactId}</docker.location>\r
         <datarouter.prov.image.name>onap/dmaap/datarouter-prov</datarouter.prov.image.name>\r
+\r
+        <timestamp>${maven.build.timestamp}</timestamp>\r
+        <maven.build.timestamp.format>yyyyMMdd'T'HHmmss'Z'</maven.build.timestamp.format>\r
+\r
+        <docker.verbose>true</docker.verbose>\r
+        <docker.apiVersion>1.23</docker.apiVersion>\r
     </properties>\r
     <dependencies>\r
         <dependency>\r
     </properties>\r
     <dependencies>\r
         <dependency>\r
             </properties>\r
             <build>\r
                 <plugins>\r
             </properties>\r
             <build>\r
                 <plugins>\r
+\r
+                    <!-- Setup image tags per https://wiki.onap.org/display/DW/Independent+Versioning+and+Release+Process#IndependentVersioningandReleaseProcess-StandardizedDockerTagging -->\r
+                    <plugin>\r
+                      <groupId>org.codehaus.groovy.maven</groupId>\r
+                      <artifactId>gmaven-plugin</artifactId>\r
+                      <executions>\r
+                          <execution>\r
+                              <phase>validate</phase>\r
+                              <goals>\r
+                                  <goal>execute</goal>\r
+                              </goals>\r
+                              <configuration>\r
+                                  <properties>\r
+                                      <ver>${project.version}</ver>\r
+                                      <timestamp>${maven.build.timestamp}</timestamp>\r
+                                  </properties>\r
+                                  <source>\r
+                                      println 'ver: ' + project.properties['ver'];\r
+                                      if ( project.properties['ver'].endsWith("-SNAPSHOT") ) {\r
+                                          project.properties['dockertag1']=project.properties['ver'] + "-latest";\r
+                                          project.properties['dockertag2']=project.properties['ver'] + "-" + project.properties['timestamp'];\r
+                                      } else {\r
+                                          project.properties['dockertag1']=project.properties['ver'] + "-STAGING-latest";\r
+                                          project.properties['dockertag2']=project.properties['ver'] + "-STAGING-" + project.properties['timestamp'];\r
+                                      }\r
+                                      println 'docker tag 1: ' + project.properties['dockertag1'];\r
+                                      println 'docker tag 2: ' + project.properties['dockertag2'];\r
+                                  </source>\r
+                              </configuration>\r
+                          </execution>\r
+                      </executions>\r
+                    </plugin>\r
                     <plugin>\r
                     <plugin>\r
-                        <groupId>com.spotify</groupId>\r
+                        <groupId>io.fabric8</groupId>\r
                         <artifactId>docker-maven-plugin</artifactId>\r
                         <artifactId>docker-maven-plugin</artifactId>\r
-                        <version>1.0.0</version>\r
+                        <version>0.28.0</version>\r
                         <configuration>\r
                         <configuration>\r
-                            <imageName>${onap.nexus.dockerregistry.daily}/${datarouter.prov.image.name}</imageName>\r
-                            <baseImage>java:8</baseImage>\r
-                            <serverId>${onap.nexus.dockerregistry.daily}</serverId>\r
-                            <skipDockerBuild>false</skipDockerBuild>\r
-                            <imageTags>\r
-                                <imageTag>${project.version}</imageTag>\r
-                                <imageTag>latest</imageTag>\r
-                            </imageTags>\r
-                            <forceTags>true</forceTags>\r
-                            <entryPoint>["/startup.sh", "start"]</entryPoint>\r
-                            <resources>\r
-                                <resource>\r
-                                    <targetPath>/opt</targetPath>\r
-                                    <directory>${project.build.directory}/opt</directory>\r
-                                </resource>\r
-                                <resource>\r
-                                    <targetPath>/</targetPath>\r
-                                    <directory>${docker.location}</directory>\r
-                                    <include>startup.sh</include>\r
-                                </resource>\r
-                            </resources>\r
-                            <runs>\r
-                                <run>chmod 0700 /startup.sh</run>\r
-                            </runs>\r
-                            <exposes>\r
-                                <expose>8080</expose>\r
-                                <expose>8443</expose>\r
-                            </exposes>\r
+                            <verbose>${docker.verbose}</verbose>\r
+                            <apiVersion>${docker.apiVersion}</apiVersion>\r
+                            <pullRegistry>${docker.pull.registry}</pullRegistry>\r
+                            <pushRegistry>${docker.push.registry}</pushRegistry>\r
+                            <images>\r
+                                <image>\r
+                                    <name>${datarouter.prov.image.name}</name>\r
+                                    <build>\r
+                                        <cleanup>try</cleanup>\r
+                                        <dockerFileDir>${basedir}/target/docker-stage</dockerFileDir>\r
+                                        <dockerFile>Dockerfile</dockerFile>\r
+                                        <tags>\r
+                                            <tag>${dockertag1}</tag>\r
+                                            <tag>${dockertag2}</tag>\r
+                                        </tags>\r
+                                    </build>\r
+                                </image>\r
+                            </images>\r
                         </configuration>\r
                         </configuration>\r
+                         <executions>\r
+                             <execution>\r
+                                 <id>generate-images</id>\r
+                                 <phase>install</phase>\r
+                                 <goals>\r
+                                     <goal>build</goal>\r
+                                 </goals>\r
+                             </execution>\r
+                             <execution>\r
+                                 <id>push-images</id>\r
+                                 <phase>deploy</phase>\r
+                                 <goals>\r
+                                     <goal>push</goal>\r
+                                 </goals>\r
+                             </execution>\r
+                         </executions>\r
                     </plugin>\r
                 </plugins>\r
             </build>\r
                     </plugin>\r
                 </plugins>\r
             </build>\r
                     <descriptorRefs>\r
                         <descriptorRef>jar-with-dependencies</descriptorRef>\r
                     </descriptorRefs>\r
                     <descriptorRefs>\r
                         <descriptorRef>jar-with-dependencies</descriptorRef>\r
                     </descriptorRefs>\r
-                    <outputDirectory>${basedir}/target/opt/app/datartr/lib</outputDirectory>\r
+                    <outputDirectory>${basedir}/target/docker-stage/opt/app/datartr/lib</outputDirectory>\r
                     <archive>\r
                         <manifest>\r
                             <addClasspath>true</addClasspath>\r
                     <archive>\r
                         <manifest>\r
                             <addClasspath>true</addClasspath>\r
                 </configuration>\r
                 <version>3.6.0</version>\r
             </plugin>\r
                 </configuration>\r
                 <version>3.6.0</version>\r
             </plugin>\r
+\r
+            <!-- Copy files to docker-stage to be included in image -->\r
             <plugin>\r
                 <artifactId>maven-resources-plugin</artifactId>\r
                 <version>2.7</version>\r
                 <executions>\r
                     <execution>\r
             <plugin>\r
                 <artifactId>maven-resources-plugin</artifactId>\r
                 <version>2.7</version>\r
                 <executions>\r
                     <execution>\r
-                        <id>copy-docker-file</id>\r
-                        <phase>package</phase>\r
+                        <id>copy-dockerfile</id>\r
+                        <phase>validate</phase>\r
                         <goals>\r
                             <goal>copy-resources</goal>\r
                         </goals>\r
                         <configuration>\r
                         <goals>\r
                             <goal>copy-resources</goal>\r
                         </goals>\r
                         <configuration>\r
-                            <outputDirectory>${docker.location}</outputDirectory>\r
+                            <outputDirectory>${basedir}/target/docker-stage</outputDirectory>\r
                             <overwrite>true</overwrite>\r
                             <resources>\r
                                 <resource>\r
                                     <directory>${basedir}/src/main/resources/docker</directory>\r
                                     <filtering>true</filtering>\r
                                     <includes>\r
                             <overwrite>true</overwrite>\r
                             <resources>\r
                                 <resource>\r
                                     <directory>${basedir}/src/main/resources/docker</directory>\r
                                     <filtering>true</filtering>\r
                                     <includes>\r
-                                        <include>**/*</include>\r
+                                        <include>Dockerfile</include>\r
                                     </includes>\r
                                 </resource>\r
                             </resources>\r
                         </configuration>\r
                     </execution>\r
                     <execution>\r
                                     </includes>\r
                                 </resource>\r
                             </resources>\r
                         </configuration>\r
                     </execution>\r
                     <execution>\r
-                        <id>copy-resources-1</id>\r
+                        <id>copy-startup-script</id>\r
                         <phase>validate</phase>\r
                         <goals>\r
                             <goal>copy-resources</goal>\r
                         </goals>\r
                         <configuration>\r
                         <phase>validate</phase>\r
                         <goals>\r
                             <goal>copy-resources</goal>\r
                         </goals>\r
                         <configuration>\r
-                            <outputDirectory>${basedir}/target/opt/app/datartr/lib</outputDirectory>\r
+                            <outputDirectory>${basedir}/target/docker-stage/opt</outputDirectory>\r
+                            <overwrite>true</overwrite>\r
                             <resources>\r
                                 <resource>\r
                             <resources>\r
                                 <resource>\r
-                                    <directory>${project.basedir}/src/main/resources</directory>\r
+                                    <directory>${basedir}/src/main/resources/docker</directory>\r
+                                    <filtering>true</filtering>\r
                                     <includes>\r
                                     <includes>\r
-                                        <include>**/*.jar</include>\r
+                                        <include>startup.sh</include>\r
                                     </includes>\r
                                 </resource>\r
                             </resources>\r
                                     </includes>\r
                                 </resource>\r
                             </resources>\r
                             <goal>copy-resources</goal>\r
                         </goals>\r
                         <configuration>\r
                             <goal>copy-resources</goal>\r
                         </goals>\r
                         <configuration>\r
-                            <outputDirectory>${basedir}/target/opt/app/datartr/etc</outputDirectory>\r
+                            <outputDirectory>${basedir}/target/docker-stage/opt/app/datartr/etc</outputDirectory>\r
                             <resources>\r
                                 <resource>\r
                                     <directory>${basedir}/src/main/resources</directory>\r
                             <resources>\r
                                 <resource>\r
                                     <directory>${basedir}/src/main/resources</directory>\r
                             <goal>copy-resources</goal>\r
                         </goals>\r
                         <configuration>\r
                             <goal>copy-resources</goal>\r
                         </goals>\r
                         <configuration>\r
-                            <outputDirectory>${basedir}/target/opt/app/datartr</outputDirectory>\r
+                            <outputDirectory>${basedir}/target/docker-stage/opt/app/datartr</outputDirectory>\r
                             <resources>\r
                                 <resource>\r
                                     <directory>${basedir}/data</directory>\r
                             <resources>\r
                                 <resource>\r
                                     <directory>${basedir}/data</directory>\r
                             <goal>copy-resources</goal>\r
                         </goals>\r
                         <configuration>\r
                             <goal>copy-resources</goal>\r
                         </goals>\r
                         <configuration>\r
-                            <outputDirectory>${basedir}/target/opt/app/datartr/aaf_certs</outputDirectory>\r
+                            <outputDirectory>${basedir}/target/docker-stage/opt/app/datartr/aaf_certs</outputDirectory>\r
                             <resources>\r
                                 <resource>\r
                                     <directory>${basedir}/aaf_certs</directory>\r
                             <resources>\r
                                 <resource>\r
                                     <directory>${basedir}/aaf_certs</directory>\r
                             <goal>copy-dependencies</goal>\r
                         </goals>\r
                         <configuration>\r
                             <goal>copy-dependencies</goal>\r
                         </goals>\r
                         <configuration>\r
-                            <outputDirectory>${project.build.directory}/opt/app/datartr/lib</outputDirectory>\r
+                            <outputDirectory>${basedir}/target/docker-stage/opt/app/datartr/aaf_certs</outputDirectory>\r
                             <overWriteReleases>false</overWriteReleases>\r
                             <overWriteSnapshots>false</overWriteSnapshots>\r
                             <overWriteIfNewer>true</overWriteIfNewer>\r
                             <overWriteReleases>false</overWriteReleases>\r
                             <overWriteSnapshots>false</overWriteSnapshots>\r
                             <overWriteIfNewer>true</overWriteIfNewer>\r
diff --git a/datarouter-prov/src/main/resources/docker/Dockerfile b/datarouter-prov/src/main/resources/docker/Dockerfile
new file mode 100644 (file)
index 0000000..b11925a
--- /dev/null
@@ -0,0 +1,33 @@
+#########
+#  ============LICENSE_START====================================================
+#  org.onap.dmaap
+#  ===========================================================================
+#  Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+#  Modifications Copyright (C) 2018 Nokia. All rights reserved.
+#  ===========================================================================
+#  Licensed under the Apache License, Version 2.0 (the "License");
+#  you may not use this file except in compliance with the License.
+#  You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+#  ============LICENSE_END====================================================
+#
+FROM openjdk:8-jre-alpine
+
+MAINTAINER DMAAP Team
+
+COPY /opt /opt
+
+RUN apk update && apk add curl
+
+EXPOSE 8080 8443
+
+WORKDIR /opt
+RUN chmod 0700 startup.sh
+ENTRYPOINT ["sh", "startup.sh"]
index d89bcb9..1f58c42 100755 (executable)
@@ -26,7 +26,7 @@
     <parent>
         <groupId>org.onap.dmaap.datarouter</groupId>
         <artifactId>parent</artifactId>
     <parent>
         <groupId>org.onap.dmaap.datarouter</groupId>
         <artifactId>parent</artifactId>
-        <version>2.0.1-SNAPSHOT</version>
+        <version>2.0.2-SNAPSHOT</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
     <artifactId>datarouter-subscriber</artifactId>
         <relativePath>../pom.xml</relativePath>
     </parent>
     <artifactId>datarouter-subscriber</artifactId>
@@ -40,6 +40,9 @@
 
         <docker.location>${basedir}/target/${artifactId}</docker.location>
         <datarouter.prov.image.name>onap/dmaap/datarouter-subscriber</datarouter.prov.image.name>
 
         <docker.location>${basedir}/target/${artifactId}</docker.location>
         <datarouter.prov.image.name>onap/dmaap/datarouter-subscriber</datarouter.prov.image.name>
+
+        <timestamp>${maven.build.timestamp}</timestamp>
+        <maven.build.timestamp.format>yyyyMMdd'T'HHmmss'Z'</maven.build.timestamp.format>
     </properties>
     <dependencies>
         <dependency>
     </properties>
     <dependencies>
         <dependency>
             </properties>
             <build>
                 <plugins>
             </properties>
             <build>
                 <plugins>
+
+                    <!-- Setup image tags per https://wiki.onap.org/display/DW/Independent+Versioning+and+Release+Process#IndependentVersioningandReleaseProcess-StandardizedDockerTagging -->
+                    <plugin>
+                      <groupId>org.codehaus.groovy.maven</groupId>
+                      <artifactId>gmaven-plugin</artifactId>
+                      <executions>
+                          <execution>
+                              <phase>validate</phase>
+                              <goals>
+                                  <goal>execute</goal>
+                              </goals>
+                              <configuration>
+                                  <properties>
+                                      <ver>${project.version}</ver>
+                                      <timestamp>${maven.build.timestamp}</timestamp>
+                                  </properties>
+                                  <source>
+                                      println 'ver: ' + project.properties['ver'];
+                                      if ( project.properties['ver'].endsWith("-SNAPSHOT") ) {
+                                          project.properties['dockertag1']=project.properties['ver'] + "-latest";
+                                          project.properties['dockertag2']=project.properties['ver'] + "-" + project.properties['timestamp'];
+                                      } else {
+                                          project.properties['dockertag1']=project.properties['ver'] + "-STAGING-latest";
+                                          project.properties['dockertag2']=project.properties['ver'] + "-STAGING-" + project.properties['timestamp'];
+                                      }
+                                      println 'docker tag 1: ' + project.properties['dockertag1'];
+                                      println 'docker tag 2: ' + project.properties['dockertag2'];
+                                  </source>
+                              </configuration>
+                          </execution>
+                      </executions>
+                    </plugin>
                     <plugin>
                     <plugin>
-                        <groupId>com.spotify</groupId>
+                        <groupId>io.fabric8</groupId>
                         <artifactId>docker-maven-plugin</artifactId>
                         <artifactId>docker-maven-plugin</artifactId>
-                        <version>${docker.maven.plugin.version}</version>
+                        <version>0.28.0</version>
                         <configuration>
                         <configuration>
-                            <imageName>${onap.nexus.dockerregistry.daily}/${datarouter.prov.image.name}</imageName>
-                            <baseImage>java:8</baseImage>
-                            <serverId>${onap.nexus.dockerregistry.daily}</serverId>
-                            <skipDockerBuild>false</skipDockerBuild>
-                            <imageTags>
-                                <imageTag>${project.version}</imageTag>
-                                <imageTag>latest</imageTag>
-                            </imageTags>
-                            <forceTags>true</forceTags>
-                            <entryPoint>["/startup.sh", "start"]</entryPoint>
-                            <resources>
-                                <resource>
-                                    <targetPath>/opt</targetPath>
-                                    <directory>${project.build.directory}/opt</directory>
-                                </resource>
-                                <resource>
-                                    <targetPath>/</targetPath>
-                                    <directory>${docker.location}</directory>
-                                    <include>startup.sh</include>
-                                </resource>
-                            </resources>
-                            <runs>
-                                <run>chmod 0700 /startup.sh</run>
-                            </runs>
-                            <exposes>
-                                <expose>8080</expose>
-                                <expose>8443</expose>
-                            </exposes>
+                            <verbose>${docker.verbose}</verbose>
+                            <apiVersion>${docker.apiVersion}</apiVersion>
+                            <pullRegistry>${docker.pull.registry}</pullRegistry>
+                            <pushRegistry>${docker.push.registry}</pushRegistry>
+                            <images>
+                                <image>
+                                    <name>${datarouter.prov.image.name}</name>
+                                    <build>
+                                        <cleanup>try</cleanup>
+                                        <dockerFileDir>${basedir}/target/docker-stage</dockerFileDir>
+                                        <dockerFile>Dockerfile</dockerFile>
+                                        <tags>
+                                            <tag>${dockertag1}</tag>
+                                            <tag>${dockertag2}</tag>
+                                        </tags>
+                                    </build>
+                                </image>
+                            </images>
                         </configuration>
                         </configuration>
+                         <executions>
+                             <execution>
+                                 <id>generate-images</id>
+                                 <phase>install</phase>
+                                 <goals>
+                                     <goal>build</goal>
+                                 </goals>
+                             </execution>
+                             <execution>
+                                 <id>push-images</id>
+                                 <phase>deploy</phase>
+                                 <goals>
+                                     <goal>push</goal>
+                                 </goals>
+                             </execution>
+                         </executions>
                     </plugin>
                 </plugins>
             </build>
                     </plugin>
                 </plugins>
             </build>
                     <descriptorRefs>
                         <descriptorRef>jar-with-dependencies</descriptorRef>
                     </descriptorRefs>
                     <descriptorRefs>
                         <descriptorRef>jar-with-dependencies</descriptorRef>
                     </descriptorRefs>
-                    <outputDirectory>${basedir}/target/opt/app/subscriber/lib</outputDirectory>
+                    <outputDirectory>${basedir}/target/docker-stage/opt/app/subscriber/lib</outputDirectory>
                     <archive>
                         <manifest>
                             <addClasspath>true</addClasspath>
                     <archive>
                         <manifest>
                             <addClasspath>true</addClasspath>
                 <executions>
                     <execution>
                         <id>copy-docker-file</id>
                 <executions>
                     <execution>
                         <id>copy-docker-file</id>
-                        <phase>package</phase>
+                        <phase>validate</phase>
                         <goals>
                             <goal>copy-resources</goal>
                         </goals>
                         <configuration>
                         <goals>
                             <goal>copy-resources</goal>
                         </goals>
                         <configuration>
-                            <outputDirectory>${docker.location}</outputDirectory>
+                            <outputDirectory>${basedir}/target/docker-stage</outputDirectory>
                             <overwrite>true</overwrite>
                             <resources>
                                 <resource>
                             <overwrite>true</overwrite>
                             <resources>
                                 <resource>
                         </configuration>
                     </execution>
                     <execution>
                         </configuration>
                     </execution>
                     <execution>
-                        <id>copy-resources-1</id>
+                        <id>copy-startup-script</id>
                         <phase>validate</phase>
                         <goals>
                             <goal>copy-resources</goal>
                         </goals>
                         <configuration>
                         <phase>validate</phase>
                         <goals>
                             <goal>copy-resources</goal>
                         </goals>
                         <configuration>
-                            <outputDirectory>${basedir}/target/opt/app/subscriber/lib</outputDirectory>
+                            <outputDirectory>${basedir}/target/docker-stage/opt</outputDirectory>
+                            <overwrite>true</overwrite>
                             <resources>
                                 <resource>
                             <resources>
                                 <resource>
-                                    <directory>${project.basedir}/src/main/resources</directory>
+                                    <directory>${basedir}/src/main/resources/docker</directory>
+                                    <filtering>true</filtering>
                                     <includes>
                                     <includes>
-                                        <include>**/*.jar</include>
+                                        <include>startup.sh</include>
                                     </includes>
                                 </resource>
                             </resources>
                                     </includes>
                                 </resource>
                             </resources>
                             <goal>copy-resources</goal>
                         </goals>
                         <configuration>
                             <goal>copy-resources</goal>
                         </goals>
                         <configuration>
-                            <outputDirectory>${basedir}/target/opt/app/subscriber/etc</outputDirectory>
+                            <outputDirectory>${basedir}/target/docker-stage/opt/app/subscriber/etc</outputDirectory>
                             <resources>
                                 <resource>
                                     <directory>${basedir}/src/main/resources</directory>
                             <resources>
                                 <resource>
                                     <directory>${basedir}/src/main/resources</directory>
diff --git a/datarouter-subscriber/src/main/resources/docker/Dockerfile b/datarouter-subscriber/src/main/resources/docker/Dockerfile
new file mode 100644 (file)
index 0000000..fe6d2fc
--- /dev/null
@@ -0,0 +1,31 @@
+#########
+#  ============LICENSE_START====================================================
+#  org.onap.dmaap
+#  ===========================================================================
+#  Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+#  Modifications Copyright (C) 2018 Nokia. All rights reserved.
+#  ===========================================================================
+#  Licensed under the Apache License, Version 2.0 (the "License");
+#  you may not use this file except in compliance with the License.
+#  You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+#  ============LICENSE_END====================================================
+#
+FROM openjdk:8-jre-alpine
+
+MAINTAINER DMAAP Team
+
+COPY /opt /opt
+
+EXPOSE 8080 8443
+
+WORKDIR /opt
+RUN chmod 0700 startup.sh
+ENTRYPOINT ["sh", "startup.sh"]
diff --git a/pom.xml b/pom.xml
index 8ef0161..8f3672c 100755 (executable)
--- a/pom.xml
+++ b/pom.xml
@@ -26,7 +26,7 @@
     <groupId>org.onap.dmaap.datarouter</groupId>
     <artifactId>parent</artifactId>
     <name>dmaap-datarouter</name>
     <groupId>org.onap.dmaap.datarouter</groupId>
     <artifactId>parent</artifactId>
     <name>dmaap-datarouter</name>
-    <version>2.0.1-SNAPSHOT</version>
+    <version>2.0.2-SNAPSHOT</version>
     <packaging>pom</packaging>
     <url>https://github.com/att/DMAAP_DATAROUTER</url>
     <parent>
     <packaging>pom</packaging>
     <url>https://github.com/att/DMAAP_DATAROUTER</url>
     <parent>
@@ -35,7 +35,7 @@
         <version>1.2.3</version>
     </parent>
     <properties>
         <version>1.2.3</version>
     </parent>
     <properties>
-        <datarouter.version>2.0.1-SNAPSHOT</datarouter.version>
+        <datarouter.version>2.0.2-SNAPSHOT</datarouter.version>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
         <maven.compiler.source>1.8</maven.compiler.source>
         <maven.compiler.target>1.8</maven.compiler.target>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
         <maven.compiler.source>1.8</maven.compiler.source>
         <maven.compiler.target>1.8</maven.compiler.target>
@@ -59,7 +59,6 @@
         <releaseNexusPath>/content/repositories/releases/</releaseNexusPath>
         <stagingNexusPath>/content/repositories/staging/</stagingNexusPath>
         <sitePath>/content/sites/site/org/onap/dmaap/datarouter/${project.artifactId}/${project.version}</sitePath>
         <releaseNexusPath>/content/repositories/releases/</releaseNexusPath>
         <stagingNexusPath>/content/repositories/staging/</stagingNexusPath>
         <sitePath>/content/sites/site/org/onap/dmaap/datarouter/${project.artifactId}/${project.version}</sitePath>
-        <docker.maven.plugin.version>1.0.0</docker.maven.plugin.version>
         <skip.docker.build>true</skip.docker.build>
         <skip.docker.tag>true</skip.docker.tag>
         <skip.docker.push>true</skip.docker.push>
         <skip.docker.build>true</skip.docker.build>
         <skip.docker.tag>true</skip.docker.tag>
         <skip.docker.push>true</skip.docker.push>
     </modules>
     <build>
         <plugins>
     </modules>
     <build>
         <plugins>
-            <plugin>
-                <groupId>com.spotify</groupId>
-                <artifactId>docker-maven-plugin</artifactId>
-                <version>${docker.maven.plugin.version}</version>
-                <configuration>
-                    <skipDockerBuild>true</skipDockerBuild>
-                </configuration>
-            </plugin>
             <plugin>
                 <groupId>org.sonatype.plugins</groupId>
                 <artifactId>nexus-staging-maven-plugin</artifactId>
             <plugin>
                 <groupId>org.sonatype.plugins</groupId>
                 <artifactId>nexus-staging-maven-plugin</artifactId>