c9eccc500ba91856c678b50e0e5965ab03e18a58
[msb/discovery.git] / distributions / msb-discovery / pom.xml
1 <?xml version="1.0" encoding="UTF-8" ?>
2 <!--
3
4     Copyright 2016-2017 ZTE, Inc. and others.
5
6     Licensed under the Apache License, Version 2.0 (the "License");
7     you may not use this file except in compliance with the License.
8     You may obtain a copy of the License at
9
10         http://www.apache.org/licenses/LICENSE-2.0
11
12     Unless required by applicable law or agreed to in writing, software
13     distributed under the License is distributed on an "AS IS" BASIS,
14     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15     See the License for the specific language governing permissions and
16     limitations under the License.
17
18 -->
19 <project xmlns="http://maven.apache.org/POM/4.0.0" 
20   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
21   <parent>
22     <groupId>org.onap.msb.discovery.distributions</groupId>
23     <artifactId>distributions-parent</artifactId>
24     <version>1.2.5-SNAPSHOT</version>
25   </parent>
26   <modelVersion>4.0.0</modelVersion>
27   <groupId>org.onap.msb.discovery.distributions</groupId>
28   <artifactId>msb-discovery</artifactId>
29   <version>1.2.5-SNAPSHOT</version>
30   <name>onap/msb/discovery/distributions/msb-discovery</name>
31   <packaging>pom</packaging>
32
33   <properties>
34
35     <openresty.version>1.11.2.2</openresty.version>
36     <packageid>msb-discovery</packageid>
37     <html.dir>openresty/nginx/html</html.dir>
38     <version.output>${project.basedir}/target/version</version.output>
39     <docker.image.name>onap/msb/msb_discovery</docker.image.name>
40     <docker.tag>${project.version}-${timestamp}</docker.tag>
41     <docker.latest.tag>${project.version}-latest</docker.latest.tag>
42   </properties>
43
44   <profiles>
45     <profile>
46       <id>linux</id>
47       <activation>
48         <activeByDefault>true</activeByDefault>
49       </activation>
50       <dependencies>
51         <dependency>
52           <groupId>org.onap.msb.discovery</groupId>
53           <artifactId>nginx-ext-consul</artifactId>
54           <type>zip</type>
55           <version>${project.version}</version>
56           <optional>true</optional>
57         </dependency>
58         <dependency>
59           <groupId>org.onap.msb.discovery.sdclient</groupId>
60           <artifactId>discovery-standalone</artifactId>
61           <type>zip</type>
62           <version>${project.version}</version>
63           <optional>true</optional>
64         </dependency>
65
66       </dependencies>
67
68
69       <build>
70         <plugins>
71           <plugin>
72             <artifactId>maven-resources-plugin</artifactId>
73             <executions>
74               <execution>
75                 <id>copy-resources-dockerfile</id>
76                 <phase>process-resources</phase>
77                 <goals>
78                   <goal>copy-resources</goal>
79                 </goals>
80                 <configuration>
81                   <outputDirectory>${version.output}</outputDirectory>
82                   <includeEmptyDirs>true</includeEmptyDirs>
83                   <resources>
84                     <resource>
85                       <directory>${dockerFileDir}</directory>
86                       <filtering>false</filtering>
87                       <includes>
88                         <include>**/*</include>
89                       </includes>
90                     </resource>
91                   </resources>
92                   <overwrite>true</overwrite>
93                 </configuration>
94               </execution>
95
96               <execution>
97                 <id>copy-resources-linux64</id>
98                 <phase>process-resources</phase>
99                 <goals>
100                   <goal>copy-resources</goal>
101                 </goals>
102                 <configuration>
103                   <outputDirectory>${linux64outputdir}</outputDirectory>
104                   <includeEmptyDirs>true</includeEmptyDirs>
105                   <resources>
106                     <resource>
107                       <directory>src/assembly/resources</directory>
108                       <filtering>false</filtering>
109                       <includes>
110                         <include>**/*</include>
111                       </includes>
112                       <excludes>
113                         <exclude>**/*.bat</exclude>
114                       </excludes>
115                     </resource>
116                   </resources>
117                   <overwrite>true</overwrite>
118                 </configuration>
119               </execution>
120             </executions>
121           </plugin>
122           <plugin>
123             <groupId>org.apache.maven.plugins</groupId>
124             <artifactId>maven-dependency-plugin</artifactId>
125             <executions>
126               <execution>
127                 <id>unpacktolinux64</id>
128                 <goals>
129                   <goal>unpack</goal>
130                 </goals>
131                 <phase>prepare-package</phase>
132                 <configuration>
133                   <artifactItems>
134                     <artifactItem>
135                       <groupId>org.onap.msb.discovery</groupId>
136                       <artifactId>nginx-ext-consul</artifactId>
137                       <type>zip</type>
138                     </artifactItem>
139                     <artifactItem>
140                       <groupId>org.onap.msb.discovery.sdclient</groupId>
141                       <artifactId>discovery-standalone</artifactId>
142                       <type>zip</type>
143                     </artifactItem>
144                   </artifactItems>
145                   <excludes>**/*.bat,*.cmd,META-INF/**</excludes>
146                   <outputDirectory>${linux64outputdir}</outputDirectory>
147                   <overWriteReleases>false</overWriteReleases>
148                   <overWriteSnapshots>true</overWriteSnapshots>
149                   <outputAbsoluteArtifactFilename>true</outputAbsoluteArtifactFilename>
150                 </configuration>
151               </execution>
152             </executions>
153           </plugin>
154           <plugin>
155             <groupId>org.apache.maven.plugins</groupId>
156             <artifactId>maven-antrun-plugin</artifactId>
157             <executions>
158               <execution>
159                 <id>distribution</id>
160                 <phase>package</phase>
161                 <goals>
162                   <goal>run</goal>
163                 </goals>
164                 <configuration>
165                   <target name="distribution">
166                     <tar destfile="${version.output}/${packageid}-${project.version}-${classifier.linux64}.tar.gz" longfile="posix" compression="gzip">
167                       <tarfileset dir="${linux64outputdir}" prefix="${packageid}" filemode="0644" dirmode="0755">
168                         <exclude name="**/*.sh"/>
169                         <exclude name="openresty/nginx/sbin/nginx"/>
170                       </tarfileset>
171                       <tarfileset dir="${linux64outputdir}" prefix="${packageid}" filemode="0755" dirmode="0755">
172                         <include name="**/*.sh"/>
173                         <include name="openresty/nginx/sbin/nginx"/>
174                       </tarfileset>
175                     </tar>
176                   </target>
177                 </configuration>
178               </execution>
179             </executions>
180           </plugin>
181         </plugins>
182       </build>
183     </profile>
184     <profile>
185       <id>docker</id>
186       <build>
187         <plugins>
188           <plugin>
189             <groupId>io.fabric8</groupId>
190             <artifactId>docker-maven-plugin</artifactId>
191             <version>0.19.1</version>
192             <dependencies>
193               <dependency>
194                 <groupId>com.github.jnr</groupId>
195                 <artifactId>jnr-unixsocket</artifactId>
196                 <version>0.13</version>
197               </dependency>
198             </dependencies>
199             <configuration>
200               <verbose>true</verbose>
201               <apiVersion>1.23</apiVersion>
202               <registry>nexus3.onap.org:10003</registry>
203               <images>
204                 <image>
205                   <name>${docker.image.name}</name>
206                   <alias>docker_msb_discovery</alias>
207                   <build>
208                     <cleanup>true</cleanup>
209                     <tags>
210                       <tag>${docker.tag}</tag>
211                       <tag>${docker.latest.tag}</tag>
212                     </tags>
213                     <dockerFileDir>${version.output}</dockerFileDir>
214                     <!--assembly>
215                         <descriptorRef>artifact</descriptorRef>
216                     </assembly-->
217                   </build>
218                 </image>
219               </images>
220             </configuration>
221             <executions>
222               <execution>
223                 <id>clean-images</id>
224                 <phase>pre-clean</phase>
225                 <goals>
226                   <goal>remove</goal>
227                 </goals>
228                 <configuration>
229                   <removeAll>true</removeAll>
230                   <image>docker_msb_discovery</image>
231                 </configuration>
232               </execution>
233               <execution>
234                 <id>generate-images</id>
235                 <phase>package</phase>
236                 <goals>
237                   <goal>build</goal>
238                 </goals>
239               </execution>
240               <execution>
241                 <id>push-images</id>
242                 <phase>deploy</phase>
243                 <goals>
244                   <goal>push</goal>
245                 </goals>
246                 <configuration>
247                   <image>${docker.image.name}</image>
248                 </configuration>
249               </execution>
250             </executions>
251           </plugin>
252         </plugins>
253       </build>
254     </profile>
255   </profiles>
256 </project>
257