Jorge Hernandez | 638480e | 2019-02-07 15:58:58 -0600 | [diff] [blame] | 1 | <!-- |
| 2 | ============LICENSE_START======================================================= |
| 3 | ONAP |
| 4 | ================================================================================ |
jhh | 927533c | 2020-02-16 19:49:42 -0600 | [diff] [blame] | 5 | Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved. |
Bruno Sakoto | 0945c4f | 2020-01-07 17:48:00 -0500 | [diff] [blame] | 6 | Modifications Copyright (C) 2019-2020 Bell Canada. |
Jorge Hernandez | 638480e | 2019-02-07 15:58:58 -0600 | [diff] [blame] | 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> |
Jorge Hernandez | 638480e | 2019-02-07 15:58:58 -0600 | [diff] [blame] | 26 | <parent> |
| 27 | <groupId>org.onap.policy.drools-applications.controlloop.packages</groupId> |
Ram Krishna Verma | d0cbee1 | 2020-02-07 13:03:27 -0500 | [diff] [blame] | 28 | <artifactId>drools-applications-packages</artifactId> |
Taka Cho | 89d7bfc | 2020-10-08 08:34:34 -0400 | [diff] [blame^] | 29 | <version>1.7.3-SNAPSHOT</version> |
Jorge Hernandez | 638480e | 2019-02-07 15:58:58 -0600 | [diff] [blame] | 30 | </parent> |
Jorge Hernandez | 638480e | 2019-02-07 15:58:58 -0600 | [diff] [blame] | 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 | |
Rashmi Pujar | 19cade1 | 2019-06-03 17:14:45 -0400 | [diff] [blame] | 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 | |
Jorge Hernandez | 638480e | 2019-02-07 15:58:58 -0600 | [diff] [blame] | 50 | <build> |
Rashmi Pujar | 19cade1 | 2019-06-03 17:14:45 -0400 | [diff] [blame] | 51 | <finalName>${project.artifactId}-${project.version}</finalName> |
Jorge Hernandez | 638480e | 2019-02-07 15:58:58 -0600 | [diff] [blame] | 52 | <plugins> |
| 53 | <plugin> |
Rashmi Pujar | 19cade1 | 2019-06-03 17:14:45 -0400 | [diff] [blame] | 54 | <groupId>org.codehaus.groovy.maven</groupId> |
| 55 | <artifactId>gmaven-plugin</artifactId> |
| 56 | <version>1.0</version> |
Jorge Hernandez | 638480e | 2019-02-07 15:58:58 -0600 | [diff] [blame] | 57 | <executions> |
| 58 | <execution> |
Rashmi Pujar | 19cade1 | 2019-06-03 17:14:45 -0400 | [diff] [blame] | 59 | <phase>validate</phase> |
Jorge Hernandez | 638480e | 2019-02-07 15:58:58 -0600 | [diff] [blame] | 60 | <goals> |
Rashmi Pujar | 19cade1 | 2019-06-03 17:14:45 -0400 | [diff] [blame] | 61 | <goal>execute</goal> |
Jorge Hernandez | 638480e | 2019-02-07 15:58:58 -0600 | [diff] [blame] | 62 | </goals> |
| 63 | <configuration> |
Rashmi Pujar | 19cade1 | 2019-06-03 17:14:45 -0400 | [diff] [blame] | 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> |
Jorge Hernandez | 638480e | 2019-02-07 15:58:58 -0600 | [diff] [blame] | 79 | </configuration> |
| 80 | </execution> |
| 81 | </executions> |
| 82 | </plugin> |
Bruno Sakoto | 0945c4f | 2020-01-07 17:48:00 -0500 | [diff] [blame] | 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> |
Jorge Hernandez | 638480e | 2019-02-07 15:58:58 -0600 | [diff] [blame] | 109 | <plugin> |
Rashmi Pujar | 19cade1 | 2019-06-03 17:14:45 -0400 | [diff] [blame] | 110 | <groupId>io.fabric8</groupId> |
| 111 | <artifactId>docker-maven-plugin</artifactId> |
Jorge Hernandez | 638480e | 2019-02-07 15:58:58 -0600 | [diff] [blame] | 112 | <configuration> |
Rashmi Pujar | 19cade1 | 2019-06-03 17:14:45 -0400 | [diff] [blame] | 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> |
Bruno Sakoto | 0945c4f | 2020-01-07 17:48:00 -0500 | [diff] [blame] | 122 | <contextDir>${project.build.directory}/docker-tmp</contextDir> |
Rashmi Pujar | 19cade1 | 2019-06-03 17:14:45 -0400 | [diff] [blame] | 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> |
Rashmi Pujar | 19cade1 | 2019-06-03 17:14:45 -0400 | [diff] [blame] | 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> |
Jorge Hernandez | 638480e | 2019-02-07 15:58:58 -0600 | [diff] [blame] | 170 | </configuration> |
| 171 | </plugin> |
Jorge Hernandez | 638480e | 2019-02-07 15:58:58 -0600 | [diff] [blame] | 172 | </plugins> |
| 173 | </build> |
Rashmi Pujar | 19cade1 | 2019-06-03 17:14:45 -0400 | [diff] [blame] | 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> |
Jorge Hernandez | 638480e | 2019-02-07 15:58:58 -0600 | [diff] [blame] | 182 | </project> |