5c7649218b86e8b7dcc784d9b330213793307932
[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.1.1-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                                 if (project.properties['dist.project.version'] != null) {
65                                     def versionArray = project.properties['dist.project.version'].split('-')
66                                     def minMaxVersionArray = versionArray[0].tokenize('.')
67                                     if (project.properties['dist.project.version'].endsWith("-SNAPSHOT")) {
68                                         project.properties['project.docker.latest.minmax.tag.version'] =
69                                             minMaxVersionArray[0] + "." + minMaxVersionArray[1] + "-SNAPSHOT-latest"
70                                     } else {
71                                         project.properties['project.docker.latest.minmax.tag.version'] =
72                                             minMaxVersionArray[0] + "." + minMaxVersionArray[1] + "-STAGING-latest"
73                                     }
74                                     println 'New tag for docker: ' + project.properties['project.docker.latest.minmax.tag.version']
75                                 }
76                             </source>
77                         </configuration>
78                     </execution>
79                 </executions>
80             </plugin>
81
82             <plugin>
83                 <groupId>io.fabric8</groupId>
84                 <artifactId>docker-maven-plugin</artifactId>
85                 <version>0.28.0</version>
86
87                 <configuration>
88                     <verbose>true</verbose>
89                     <apiVersion>1.23</apiVersion>
90                     <pullRegistry>${docker.pull.registry}</pullRegistry>
91                     <pushRegistry>${docker.push.registry}</pushRegistry>
92
93                     <images>
94                         <image>
95                             <name>onap/policy-pap</name>
96                             <build>
97                                 <cleanup>try</cleanup>
98                                 <dockerFile>Dockerfile</dockerFile>
99                                 <tags>
100                                     <tag>${project.version}</tag>
101                                     <tag>${project.version}-${maven.build.timestamp}</tag>
102                                     <tag>${project.docker.latest.minmax.tag.version}</tag>
103                                 </tags>
104                                 <assembly>
105                                     <inline>
106                                         <dependencySets>
107                                             <dependencySet>
108                                                 <includes>
109                                                     <include>org.onap.policy.pap:policy-pap-tarball</include>
110                                                 </includes>
111                                                 <outputDirectory>/lib</outputDirectory>
112                                                 <outputFileNameMapping>policy-pap.tar.gz</outputFileNameMapping>
113                                             </dependencySet>
114                                         </dependencySets>
115                                     </inline>
116                                 </assembly>
117                             </build>
118                         </image>
119                     </images>
120                 </configuration>
121
122                 <executions>
123                     <execution>
124                         <id>clean-images</id>
125                         <phase>pre-clean</phase>
126                         <goals>
127                             <goal>remove</goal>
128                         </goals>
129                         <configuration>
130                             <removeAll>true</removeAll>
131                         </configuration>
132                     </execution>
133
134                     <execution>
135                         <id>generate-images</id>
136                         <phase>generate-sources</phase>
137                         <goals>
138                             <goal>build</goal>
139                         </goals>
140                     </execution>
141
142                     <execution>
143                         <id>push-images</id>
144                         <phase>deploy</phase>
145                         <goals>
146                             <goal>build</goal>
147                             <goal>push</goal>
148                         </goals>
149                         <configuration>
150                             <image>onap/policy-pap</image>
151                         </configuration>
152                     </execution>
153                 </executions>
154             </plugin>
155
156             <plugin>
157                 <groupId>org.apache.maven.plugins</groupId>
158                 <artifactId>maven-deploy-plugin</artifactId>
159                 <configuration>
160                     <skip>true</skip>
161                 </configuration>
162             </plugin>
163         </plugins>
164     </build>
165
166     <dependencies>
167         <dependency>
168             <groupId>org.onap.policy.pap</groupId>
169             <artifactId>policy-pap-tarball</artifactId>
170             <version>${project.version}</version>
171             <classifier>tarball</classifier>
172             <type>tar.gz</type>
173         </dependency>
174     </dependencies>
175 </project>