Bump Drools-Apps to 1.7.0
[policy/drools-applications.git] / controlloop / packages / docker-controlloop / pom.xml
1 <!--
2   ============LICENSE_START=======================================================
3   ONAP
4   ================================================================================
5   Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
6   Modifications Copyright (C) 2019-2020 Bell Canada.
7   ================================================================================
8   Licensed under the Apache License, Version 2.0 (the "License");
9   you may not use this file except in compliance with the License.
10   You may obtain a copy of the License at
11
12          http://www.apache.org/licenses/LICENSE-2.0
13
14   Unless required by applicable law or agreed to in writing, software
15   distributed under the License is distributed on an "AS IS" BASIS,
16   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17   See the License for the specific language governing permissions and
18   limitations under the License.
19   ============LICENSE_END=========================================================
20   -->
21
22 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
23     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
24
25     <modelVersion>4.0.0</modelVersion>
26     <parent>
27         <groupId>org.onap.policy.drools-applications.controlloop.packages</groupId>
28         <artifactId>drools-applications-packages</artifactId>
29         <version>1.7.0-SNAPSHOT</version>
30     </parent>
31     <artifactId>docker-controlloop</artifactId>
32     <packaging>pom</packaging>
33
34     <name>docker-controlloop</name>
35     <description>ONAP Policy Control Loop PDP-D Docker Build</description>
36
37     <properties>
38         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
39         <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
40         <dist.project.version>${project.version}</dist.project.version>
41         <docker.skip>false</docker.skip>
42         <docker.skip.build>false</docker.skip.build>
43         <docker.skip.push>false</docker.skip.push>
44         <docker.pull.registry>nexus3.onap.org:10001</docker.pull.registry>
45         <docker.push.registry>nexus3.onap.org:10003</docker.push.registry>
46         <maven.build.timestamp.format>yyyyMMdd'T'HHmm</maven.build.timestamp.format>
47         <docker.buildArg.BUILD_VERSION_APP_CL>${project.version}</docker.buildArg.BUILD_VERSION_APP_CL>
48     </properties>
49
50     <build>
51         <finalName>${project.artifactId}-${project.version}</finalName>
52         <plugins>
53             <plugin>
54                 <groupId>org.codehaus.groovy.maven</groupId>
55                 <artifactId>gmaven-plugin</artifactId>
56                 <version>1.0</version>
57                 <executions>
58                     <execution>
59                         <phase>validate</phase>
60                         <goals>
61                             <goal>execute</goal>
62                         </goals>
63                         <configuration>
64                             <source>
65                                 println 'Project version: ' + project.properties['dist.project.version']
66                                 if (project.properties['dist.project.version'] != null) {
67                                     def versionArray = project.properties['dist.project.version'].split('-')
68                                     def minMaxVersionArray = versionArray[0].tokenize('.')
69                                     if (project.properties['dist.project.version'].endsWith("-SNAPSHOT")) {
70                                         project.properties['project.docker.latest.minmax.tag.version'] =
71                                             minMaxVersionArray[0] + "." + minMaxVersionArray[1] + "-SNAPSHOT-latest"
72                                     } else {
73                                         project.properties['project.docker.latest.minmax.tag.version'] =
74                                             minMaxVersionArray[0] + "." + minMaxVersionArray[1] + "-STAGING-latest"
75                                     }
76                                     println 'New tag for docker: ' + properties['project.docker.latest.minmax.tag.version']
77                                 }
78                             </source>
79                         </configuration>
80                     </execution>
81                 </executions>
82             </plugin>
83             <!--fabric8.io docker-maven-plugin does not support ARG usage in the FROM statement of Dockerfile
84              even though docker supports it: https://github.com/fabric8io/docker-maven-plugin/issues/859.
85              As a workaround we shall use maven-antrun-plugin to copy the Dockerfile and apply filters to
86              replace the parameterized base-image version. The fabric8.io docker-maven-plugin shall use this filtered file
87              to build the image. After the image is built we perform a cleanup to remove the filtered file.-->
88             <plugin>
89                 <artifactId>maven-antrun-plugin</artifactId>
90                 <executions>
91                     <execution>
92                         <id>update-parameterized-dockerfile</id>
93                         <phase>initialize</phase>
94                         <goals>
95                             <goal>run</goal>
96                         </goals>
97                         <configuration>
98                             <tasks>
99                                 <copy file="src/main/docker/Dockerfile" toFile="${project.build.directory}/docker-tmp/Dockerfile">
100                                     <filterset>
101                                         <filter token="version.policy.drools-pdp" value="${version.policy.drools-pdp}"/>
102                                     </filterset>
103                                 </copy>
104                             </tasks>
105                         </configuration>
106                     </execution>
107                 </executions>
108             </plugin>
109             <plugin>
110                 <groupId>io.fabric8</groupId>
111                 <artifactId>docker-maven-plugin</artifactId>
112                 <configuration>
113                     <verbose>true</verbose>
114                     <apiVersion>1.23</apiVersion>
115                     <pullRegistry>${docker.pull.registry}</pullRegistry>
116                     <pushRegistry>${docker.push.registry}</pushRegistry>
117                     <images>
118                         <image>
119                             <name>onap/policy-pdpd-cl</name>
120                             <build>
121                                 <cleanup>try</cleanup>
122                                 <contextDir>${project.build.directory}/docker-tmp</contextDir>
123                                 <dockerFile>Dockerfile</dockerFile>
124                                 <tags>
125                                     <tag>${project.version}</tag>
126                                     <tag>${project.version}-${maven.build.timestamp}</tag>
127                                     <tag>${project.docker.latest.minmax.tag.version}</tag>
128                                 </tags>
129                                 <assembly>
130                                     <descriptor>${project.basedir}/src/main/assembly/assembly.xml</descriptor>
131                                     <user>policy:policy:policy</user>
132                                 </assembly>
133                             </build>
134                         </image>
135                     </images>
136                 </configuration>
137                 <executions>
138                     <execution>
139                         <id>clean-images</id>
140                         <phase>pre-clean</phase>
141                         <goals>
142                             <goal>remove</goal>
143                         </goals>
144                         <configuration>
145                             <removeAll>true</removeAll>
146                         </configuration>
147                     </execution>
148                     <execution>
149                         <id>generate-images</id>
150                         <phase>generate-sources</phase>
151                         <goals>
152                             <goal>build</goal>
153                         </goals>
154                     </execution>
155                     <execution>
156                         <id>push-images</id>
157                         <phase>deploy</phase>
158                         <goals>
159                             <goal>build</goal>
160                             <goal>push</goal>
161                         </goals>
162                     </execution>
163                 </executions>
164             </plugin>
165             <plugin>
166                 <groupId>org.apache.maven.plugins</groupId>
167                 <artifactId>maven-deploy-plugin</artifactId>
168                 <configuration>
169                     <skip>true</skip>
170                 </configuration>
171             </plugin>
172         </plugins>
173     </build>
174     <dependencies>
175         <dependency>
176             <groupId>${project.groupId}</groupId>
177             <artifactId>apps-controlloop</artifactId>
178             <version>${project.version}</version>
179             <type>zip</type>
180         </dependency>
181     </dependencies>
182 </project>