Added VNFM Simulator project
[so.git] / vnfm-simulator / packages / docker / pom.xml
1 <!-- ============LICENSE_START======================================================= 
2         Copyright (C) 2019 Nordix Foundation. ================================================================================ 
3         Licensed under the Apache License, Version 2.0 (the "License"); you may not 
4         use this file except in compliance with the License. You may obtain a copy 
5         of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required 
6         by applicable law or agreed to in writing, software distributed under the 
7         License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS 
8         OF ANY KIND, either express or implied. See the License for the specific 
9         language governing permissions and limitations under the License. SPDX-License-Identifier: 
10         Apache-2.0 ============LICENSE_END========================================================= -->
11
12 <project xmlns="http://maven.apache.org/POM/4.0.0"
13         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
14         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
15
16         <modelVersion>4.0.0</modelVersion>
17
18         <parent>
19                 <groupId>org.onap.svnfm</groupId>
20                 <artifactId>packages</artifactId>
21                 <version>1.0.0-SNAPSHOT</version>
22         </parent>
23
24         <packaging>pom</packaging>
25         <artifactId>docker</artifactId>
26         <name>Docker Images</name>
27         <description>Docker Images</description>
28
29         <properties>
30                 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
31                 <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
32                 <svnfm.project.version>${project.version}</svnfm.project.version>
33                 <docker.skip>false</docker.skip>
34                 <docker.skip.build>false</docker.skip.build>
35                 <docker.skip.push>false</docker.skip.push>
36                 <docker.pull.registry>nexus3.onap.org:10001</docker.pull.registry>
37                 <docker.push.registry>nexus3.onap.org:10003</docker.push.registry>
38                 <maven.build.timestamp.format>yyyyMMdd'T'HHmm</maven.build.timestamp.format>
39         </properties>
40
41         <build>
42                 <finalName>${project.artifactId}-${project.version}</finalName>
43                 <plugins>
44                         <plugin>
45                                 <groupId>org.codehaus.groovy.maven</groupId>
46                                 <artifactId>gmaven-plugin</artifactId>
47                                 <version>1.0</version>
48                                 <executions>
49                                         <execution>
50                                                 <phase>validate</phase>
51                                                 <goals>
52                                                         <goal>execute</goal>
53                                                 </goals>
54                                                 <configuration>
55                                                         <source>
56                                                                 println 'Project version: ' +
57                                                                 project.properties['svnfm.project.version'];
58                                                                 def versionArray;
59                                                                 if
60                                                                 (
61                                                                 project.properties['svnfm.project.version'] != null ) {
62                                                                 versionArray =
63                                                                 project.properties['svnfm.project.version'].split('-');
64                                                                 }
65
66                                                                 if (
67                                                                 project.properties['svnfm.project.version'].endsWith("-SNAPSHOT")
68                                                                 )
69                                                                 {
70                                                                 project.properties['project.docker.latesttag.version']=versionArray[0]
71                                                                 + "-SNAPSHOT-latest";
72                                                                 } else {
73                                                                 project.properties['project.docker.latesttag.version']=versionArray[0]
74                                                                 + "-STAGING-latest";
75                                                                 }
76
77                                                                 println 'New tag for docker: ' +
78                                                                 project.properties['project.docker.latesttag.version'];
79                                                         </source>
80                                                 </configuration>
81                                         </execution>
82                                 </executions>
83                         </plugin>
84
85                         <plugin>
86                                 <groupId>io.fabric8</groupId>
87                                 <artifactId>docker-maven-plugin</artifactId>
88                                 <version>0.19.1</version>
89
90                                 <configuration>
91                                         <verbose>true</verbose>
92                                         <apiVersion>1.23</apiVersion>
93                                         <pullRegistry>${docker.pull.registry}</pullRegistry>
94                                         <pushRegistry>${docker.push.registry}</pushRegistry>
95
96                                         <images>
97                                                 <image>
98                                                         <name>onap/svnfm/simulator</name>
99                                                         <build>
100                                                                 <cleanup>try</cleanup>
101                                                                 <dockerFile>Dockerfile</dockerFile>
102                                                                 <tags>
103                                                                         <tag>${project.version}</tag>
104                                                                         <tag>${project.version}-${maven.build.timestamp}</tag>
105                                                                         <tag>${project.docker.latesttag.version}</tag>
106                                                                 </tags>
107                                                                 <assembly>
108                                                                         <inline>
109                                                                                 <dependencySets>
110                                                                                         <dependencySet>
111                                                                                                 <includes>
112                                                                                                         <include>org.onap.svnfm:simulator</include>
113                                                                                                 </includes>
114                                                                                                 <outputFileNameMapping>app.jar</outputFileNameMapping>
115                                                                                         </dependencySet>
116                                                                                 </dependencySets>
117                                                                         </inline>
118                                                                 </assembly>
119                                                         </build>
120                                                 </image>
121                                         </images>
122                                 </configuration>
123
124                                 <executions>
125                                         <execution>
126                                                 <id>clean-images</id>
127                                                 <phase>pre-clean</phase>
128                                                 <goals>
129                                                         <goal>remove</goal>
130                                                 </goals>
131                                                 <configuration>
132                                                         <removeAll>true</removeAll>
133                                                 </configuration>
134                                         </execution>
135
136                                         <execution>
137                                                 <id>generate-images</id>
138                                                 <phase>generate-sources</phase>
139                                                 <goals>
140                                                         <goal>build</goal>
141                                                 </goals>
142                                         </execution>
143
144                                         <execution>
145                                                 <id>push-images</id>
146                                                 <phase>deploy</phase>
147                                                 <goals>
148                                                         <goal>build</goal>
149                                                         <goal>push</goal>
150                                                 </goals>
151                                                 <configuration>
152                                                         <image>onap/svnfm/simulator</image>
153                                                 </configuration>
154                                         </execution>
155                                 </executions>
156                         </plugin>
157
158                         <plugin>
159                                 <groupId>org.apache.maven.plugins</groupId>
160                                 <artifactId>maven-deploy-plugin</artifactId>
161                                 <version>2.8</version>
162                                 <configuration>
163                                         <skip>true</skip>
164                                 </configuration>
165                         </plugin>
166                 </plugins>
167         </build>
168 </project>