Chenfei Gao | 6ea2e1b | 2019-01-31 16:09:09 -0500 | [diff] [blame] | 1 | <!-- |
| 2 | ============LICENSE_START======================================================= |
| 3 | Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. |
| 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 | |
| 24 | <modelVersion>4.0.0</modelVersion> |
| 25 | |
| 26 | <parent> |
| 27 | <groupId>org.onap.policy.api</groupId> |
| 28 | <artifactId>packages</artifactId> |
Pamela Dragosh | 9bcc74f | 2019-05-30 09:42:01 -0400 | [diff] [blame] | 29 | <version>2.1.0-SNAPSHOT</version> |
Chenfei Gao | 6ea2e1b | 2019-01-31 16:09:09 -0500 | [diff] [blame] | 30 | </parent> |
| 31 | |
| 32 | <packaging>pom</packaging> |
| 33 | <artifactId>policy-api-docker</artifactId> |
| 34 | <name>Policy api docker image</name> |
| 35 | <description>Policy api docker image</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 | </properties> |
| 48 | |
| 49 | <build> |
| 50 | <finalName>${project.artifactId}-${project.version}</finalName> |
| 51 | <plugins> |
| 52 | <plugin> |
| 53 | <groupId>org.codehaus.groovy.maven</groupId> |
| 54 | <artifactId>gmaven-plugin</artifactId> |
| 55 | <version>1.0</version> |
| 56 | <executions> |
| 57 | <execution> |
| 58 | <phase>validate</phase> |
| 59 | <goals> |
| 60 | <goal>execute</goal> |
| 61 | </goals> |
| 62 | <configuration> |
| 63 | <source> |
Rashmi Pujar | 11e7349 | 2019-06-07 15:48:40 -0400 | [diff] [blame^] | 64 | println 'Project version: ' + project.properties['dist.project.version'] |
| 65 | if (project.properties['dist.project.version'] != null) { |
| 66 | def versionArray = project.properties['dist.project.version'].split('-') |
| 67 | def minMaxVersionArray = versionArray[0].tokenize('.') |
| 68 | if (project.properties['dist.project.version'].endsWith("-SNAPSHOT")) { |
| 69 | project.properties['project.docker.latest.minmax.tag.version'] = |
| 70 | minMaxVersionArray[0] + "." + minMaxVersionArray[1] + "-SNAPSHOT-latest" |
| 71 | } else { |
| 72 | project.properties['project.docker.latest.minmax.tag.version'] = |
| 73 | minMaxVersionArray[0] + "." + minMaxVersionArray[1] + "-STAGING-latest" |
| 74 | } |
| 75 | println 'New tag for docker: ' + project.properties['project.docker.latest.minmax.tag.version'] |
Chenfei Gao | 6ea2e1b | 2019-01-31 16:09:09 -0500 | [diff] [blame] | 76 | } |
Chenfei Gao | 6ea2e1b | 2019-01-31 16:09:09 -0500 | [diff] [blame] | 77 | </source> |
| 78 | </configuration> |
| 79 | </execution> |
| 80 | </executions> |
| 81 | </plugin> |
| 82 | |
| 83 | <plugin> |
| 84 | <groupId>io.fabric8</groupId> |
| 85 | <artifactId>docker-maven-plugin</artifactId> |
Dmitry Puzikov | a0745a7 | 2019-03-25 15:00:06 +0100 | [diff] [blame] | 86 | <version>0.28.0</version> |
Chenfei Gao | 6ea2e1b | 2019-01-31 16:09:09 -0500 | [diff] [blame] | 87 | |
| 88 | <configuration> |
| 89 | <verbose>true</verbose> |
| 90 | <apiVersion>1.23</apiVersion> |
| 91 | <pullRegistry>${docker.pull.registry}</pullRegistry> |
| 92 | <pushRegistry>${docker.push.registry}</pushRegistry> |
| 93 | |
| 94 | <images> |
| 95 | <image> |
| 96 | <name>onap/policy-api</name> |
| 97 | <build> |
| 98 | <cleanup>try</cleanup> |
| 99 | <dockerFile>Dockerfile</dockerFile> |
| 100 | <tags> |
| 101 | <tag>${project.version}</tag> |
| 102 | <tag>${project.version}-${maven.build.timestamp}</tag> |
Rashmi Pujar | 11e7349 | 2019-06-07 15:48:40 -0400 | [diff] [blame^] | 103 | <tag>${project.docker.latest.minmax.tag.version}</tag> |
Chenfei Gao | 6ea2e1b | 2019-01-31 16:09:09 -0500 | [diff] [blame] | 104 | </tags> |
| 105 | <assembly> |
| 106 | <inline> |
| 107 | <dependencySets> |
| 108 | <dependencySet> |
| 109 | <includes> |
| 110 | <include>org.onap.policy.api:policy-api-tarball</include> |
| 111 | </includes> |
| 112 | <outputDirectory>/lib</outputDirectory> |
| 113 | <outputFileNameMapping>policy-api.tar.gz</outputFileNameMapping> |
| 114 | </dependencySet> |
| 115 | </dependencySets> |
| 116 | </inline> |
| 117 | </assembly> |
| 118 | </build> |
| 119 | </image> |
| 120 | </images> |
| 121 | </configuration> |
| 122 | |
| 123 | <executions> |
| 124 | <execution> |
| 125 | <id>clean-images</id> |
| 126 | <phase>pre-clean</phase> |
| 127 | <goals> |
| 128 | <goal>remove</goal> |
| 129 | </goals> |
| 130 | <configuration> |
| 131 | <removeAll>true</removeAll> |
| 132 | </configuration> |
| 133 | </execution> |
| 134 | |
| 135 | <execution> |
| 136 | <id>generate-images</id> |
| 137 | <phase>generate-sources</phase> |
| 138 | <goals> |
| 139 | <goal>build</goal> |
| 140 | </goals> |
| 141 | </execution> |
| 142 | |
| 143 | <execution> |
| 144 | <id>push-images</id> |
| 145 | <phase>deploy</phase> |
| 146 | <goals> |
| 147 | <goal>build</goal> |
| 148 | <goal>push</goal> |
| 149 | </goals> |
| 150 | <configuration> |
| 151 | <image>onap/policy-api</image> |
| 152 | </configuration> |
| 153 | </execution> |
| 154 | </executions> |
| 155 | </plugin> |
| 156 | |
| 157 | <plugin> |
| 158 | <groupId>org.apache.maven.plugins</groupId> |
| 159 | <artifactId>maven-deploy-plugin</artifactId> |
| 160 | <configuration> |
| 161 | <skip>true</skip> |
| 162 | </configuration> |
| 163 | </plugin> |
| 164 | </plugins> |
| 165 | </build> |
| 166 | |
| 167 | <dependencies> |
| 168 | <dependency> |
| 169 | <groupId>org.onap.policy.api</groupId> |
| 170 | <artifactId>policy-api-tarball</artifactId> |
| 171 | <version>${project.version}</version> |
| 172 | <classifier>tarball</classifier> |
| 173 | <type>tar.gz</type> |
| 174 | </dependency> |
| 175 | </dependencies> |
| 176 | </project> |