build multi-platform images 14/82314/2
authorsandovalfr <frank.sandoval@oamtechnologies.com>
Thu, 14 Mar 2019 23:39:55 +0000 (17:39 -0600)
committersandovalfr <frank.sandoval@oamtechnologies.com>
Fri, 15 Mar 2019 16:22:14 +0000 (10:22 -0600)
Issue-ID: INT-932

Change-Id: I1be60a467bf4b6ac44b9b5b2c4982feec9eee208
Signed-off-by: sandovalfr <frank.sandoval@oamtechnologies.com>
docs/Installation/Installation.rst
pom.xml
src/main/resources/docker/Dockerfile

index 83f5b6f..53d9fd2 100644 (file)
@@ -61,3 +61,62 @@ Testing
 \r
    Note: You will only receive messages which have been published after\r
    you have subscribed to a topic.\r
+\r
+\r
+Steps for local development and test\r
+------------------------\r
+On Intel dev machine, in terminal (> indicates prompt) :\r
+1) Build kafka11aaf\r
+    > git clone https://gerrit.onap.org/r/dmaap/kafka\r
+    > cd kafka11aaf\r
+    > mvn clean install -Pdocker\r
+2) Build messageservice \r
+    > git clone https://gerrit.onap.org/r/dmaap/messagerouter/messageservice\r
+        - anonymous http, can't push changes\r
+    > cd messageservice\r
+    > mvn clean install -Pdocker\r
+3) Run tests \r
+    > cp bundleconfig-local/etc/appprops/MsgRtrApi.properties /var/tmp/\r
+        - edit /var/tmp/MsgRtrApi.properties\r
+            config.zk.servers=zookeeper\r
+            kafka.metadata.broker.list=kafka:9092\r
+            - docker-compose network maps service name(zookeeper, kafka) to IP\r
+        - set docker preferences/file sharing to access /var/tmp\r
+    > cd src/main/resources/docker-compose\r
+    - edit docker-compose.yml\r
+        - remove "nexus3.onap.org:10001/" from kafka and dmaap image names to \r
+            use local images\r
+    > docker-compose up -d\r
+    - create sample.txt file (as above)(content of file not important)\r
+    > curl -H "Content-Type:text/plain" -X POST -d @sample.txt http://localhost:3904/events/TestTopic1\r
+\r
+On Arm:\r
+1) Build kafka11aaf\r
+    > git clone https://gerrit.onap.org/r/dmaap/kafka\r
+    > cd kafka11aaf\r
+    > mvn clean install -Pdocker  -Ddocker.pull.registry=docker.io\r
+        - ensure we pull Arm version of base image\r
+2) Build messageservice \r
+    > git clone https://gerrit.onap.org/r/dmaap/messagerouter/messageservice\r
+        - anonymous http, can't push changes\r
+    > cd messageservice\r
+    > mvn clean install -Pdocker  -Ddocker.pull.registry=docker.io\r
+        - ensure we pull Arm version of base image\r
+3) Run tests \r
+    > cp bundleconfig-local/etc/appprops/MsgRtrApi.properties /var/tmp/\r
+        - edit /var/tmp/MsgRtrApi.properties\r
+            config.zk.servers=zookeeper\r
+            kafka.metadata.broker.list=kafka:9092\r
+            - docker-compose network maps service name(zookeeper, kafka) to IP\r
+        - set docker preferences/file sharing to access /var/tmp\r
+    > cd src/main/resources/docker-compose\r
+    - edit docker-compose.yml\r
+        - remove "nexus3.onap.org:10001/" from from kafka and dmaap image names to \r
+            use local images\r
+        - replace 'nexus3.onap.org:10001/onap/dmaap/zookeeper:1.0.0' with\r
+            multi-platform 'zookeeper'\r
+    > docker-compose up -d\r
+    - create sample.txt file (as above)(content of file not important)\r
+    > curl -H "Content-Type:text/plain" -X POST -d @sample.txt http://localhost:3904/events/TestTopic1\r
+\r
+   \r
diff --git a/pom.xml b/pom.xml
index 2a2956e..d66c6e4 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -47,6 +47,7 @@
 
        <build>
                <plugins>
+
                        <plugin>
                                <groupId>org.apache.maven.plugins</groupId>
                                <artifactId>maven-site-plugin</artifactId>
                                        </dependency>
                                </dependencies>
                        </plugin>
+                
 
-                       <plugin>
-                               <groupId>com.spotify</groupId>
-                               <artifactId>docker-maven-plugin</artifactId>
-                               <version>1.0.0</version>
-                               <configuration>
-                                       <imageName>onap/dmaap/dmaap-mr</imageName>
-                                       <dockerDirectory>${dockerLocation}</dockerDirectory>
-                                       <serverId>docker-hub</serverId>
-                                       <imageTags>
-                                               <imageTag>${dockertag1}</imageTag>
-                                               <imageTag>${dockertag2}</imageTag>
-                                       </imageTags>
-                                       <forceTags>true</forceTags>
-                                       <resources>
-                                               <resource>
-                                                       <targetPath>/</targetPath>
-                                                       <directory>${dockerLocation}</directory>
-                                                       <include>${project.build.finalName}.jar</include>
-                                               </resource>
-                                               <resource>
-                                                       <targetPath>/</targetPath>
-                                                       <directory>${project.build.directory}</directory>
-                                                       <include>**/**</include>
-                                               </resource>
-                                       </resources>
-                               </configuration>
-                               <executions>
-                                       <execution>
-                                               <id>build-image</id>
-                                               <phase>install</phase>
-                                               <goals>
-                                                       <goal>build</goal>
-                                               </goals>
-                                               <configuration>
-                                                       <skipDockerBuild>${skip.docker.build}</skipDockerBuild>
-                                               </configuration>
-                                       </execution>
-
-                                       <execution>
-                                               <id>tag-image-project-version</id>
-                                               <phase>install</phase>
-                                               <goals>
-                                                       <goal>tag</goal>
-                                               </goals>
-                                               <configuration>
-                                                       <image>onap/dmaap/dmaap-mr</image>
-                                                       <newName>${docker.push.registry}/onap/dmaap/dmaap-mr:${dockertag2}</newName>
-                                                       <skipDockerTag>${skip.docker.push}</skipDockerTag>
-                                               </configuration>
-                                       </execution>
-
-                                       <execution>
-                                               <id>tag-image-latest</id>
-                                               <phase>install</phase>
-                                               <goals>
-                                                       <goal>tag</goal>
-                                               </goals>
-                                               <configuration>
-                                                       <image>onap/dmaap/dmaap-mr</image>
-                                                       <newName>${docker.push.registry}/onap/dmaap/dmaap-mr:${dockertag1}</newName>
-                                                       <skipDockerTag>${skip.docker.push}</skipDockerTag>
-                                               </configuration>
-                                       </execution>
-
-                                       <execution>
-                                               <id>push-image-latest</id>
-                                               <phase>deploy</phase>
-                                               <goals>
-                                                       <goal>push</goal>
-                                               </goals>
-                                               <configuration>
-                                                       <imageName>${docker.push.registry}/onap/dmaap/dmaap-mr:${dockertag2}</imageName>
-                                                       <skipDockerPush>${skip.docker.push}</skipDockerPush>
-                                               </configuration>
-                                       </execution>
-
-                                       <execution>
-                                               <id>push-image</id>
-                                               <phase>deploy</phase>
-                                               <goals>
-                                                       <goal>push</goal>
-                                               </goals>
-                                               <configuration>
-                                                       <imageName>${docker.push.registry}/onap/dmaap/dmaap-mr:${dockertag1}</imageName>
-                                                       <skipDockerPush>${skip.docker.push}</skipDockerPush>
-                                               </configuration>
-                                       </execution>
-                               </executions>
-                       </plugin>
                        <plugin>
                                <groupId>com.blackducksoftware.integration</groupId>
                                <artifactId>hub-maven-plugin</artifactId>
                <camel.version>2.21.1</camel.version>
                <sitePath>/content/sites/site/org/onap/dmaap/messagerouter/messageservice/${project.artifactId}/${project.version}</sitePath>
                <skip.docker.build>true</skip.docker.build>
+               <skip.docker.tag>true</skip.docker.tag>
                <skip.docker.push>true</skip.docker.push>
                <nexusproxy>https://nexus.onap.org</nexusproxy>
                <docker.push.registry>nexus3.onap.org:10003</docker.push.registry>
                             </execution>
                         </executions>
                     </plugin>
-                    </plugins>
-                    </build>
+                   <plugin>
+                        <groupId>io.fabric8</groupId>
+                        <artifactId>docker-maven-plugin</artifactId>
+                        <version>0.28.0</version>  
+                        <configuration>
+                            <verbose>${docker.verbose}</verbose>
+                            <apiVersion>${docker.apiVersion}</apiVersion>
+                            <pullRegistry>${docker.pull.registry}</pullRegistry>
+                            <pushRegistry>${docker.push.registry}</pushRegistry>
+                            <images>
+                                <image>                            
+                                    <name>onap/dmaap/dmaap-mr</name>
+                                    <build>
+                                        <cleanup>try</cleanup>
+                                        <dockerFileDir>${dockerLocation}</dockerFileDir>
+                                        <dockerFile>Dockerfile</dockerFile>
+                                        <tags>
+                                            <tag>${dockertag1}</tag>
+                                            <tag>${dockertag2}</tag>
+                                        </tags>
+                                    </build>
+                                </image>
+                            </images>
+                        </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>
                </profile>
 
                <profile>
index e6356f9..2639cea 100644 (file)
@@ -1,6 +1,27 @@
-FROM openjdk:8-jdk
-ADD appl /appl/
-ADD startup.sh /startup.sh
+#########
+#  ============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-alpine
+MAINTAINER DMAAP Team
+COPY appl /appl/
+COPY    startup.sh /
 RUN chmod 700 /startup.sh
-ENTRYPOINT ./startup.sh
 EXPOSE 3904 3905
+ENTRYPOINT ["sh", "./startup.sh"]