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