Ganesh Chandrasekaran | 8ba2cee | 2019-02-12 15:01:25 +0900 | [diff] [blame^] | 1 | <?xml version="1.0" encoding="UTF-8"?> |
| 2 | <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
| 3 | <modelVersion>4.0.0</modelVersion> |
| 4 | |
| 5 | <parent> |
| 6 | <groupId>org.onap.ccsdk.distribution</groupId> |
| 7 | <artifactId>distribution-root</artifactId> |
| 8 | <version>0.4.1-SNAPSHOT</version> |
| 9 | </parent> |
| 10 | |
| 11 | <artifactId>saltstack-server</artifactId> |
| 12 | <version>0.4.1-SNAPSHOT</version> |
| 13 | <packaging>pom</packaging> |
| 14 | |
| 15 | <name>ccsdk-distribution :: saltstack-server</name> |
| 16 | <description>Creates base saltstack-server Docker container</description> |
| 17 | |
| 18 | <properties> |
| 19 | <image.name>onap/ccsdk-saltstack-server-image</image.name> |
| 20 | <ccsdk.project.version>${project.version}</ccsdk.project.version> |
| 21 | </properties> |
| 22 | |
| 23 | <build> |
| 24 | <plugins> |
| 25 | |
| 26 | <plugin> |
| 27 | <groupId>org.codehaus.groovy.maven</groupId> |
| 28 | <artifactId>gmaven-plugin</artifactId> |
| 29 | <executions> |
| 30 | <execution> |
| 31 | <phase>validate</phase> |
| 32 | <goals> |
| 33 | <goal>execute</goal> |
| 34 | </goals> |
| 35 | <configuration> |
| 36 | <source> |
| 37 | println project.properties['ccsdk.project.version']; |
| 38 | def versionArray; |
| 39 | if ( project.properties['ccsdk.project.version'] != null ) { |
| 40 | versionArray = project.properties['ccsdk.project.version'].split('\\.'); |
| 41 | } |
| 42 | |
| 43 | if (project.properties['ccsdk.project.version'].endsWith("-SNAPSHOT")) |
| 44 | { |
| 45 | project.properties['project.docker.latesttag.version']=versionArray[0] + '.' + versionArray[1] + "-STAGING-latest"; |
| 46 | } else { |
| 47 | project.properties['project.docker.latesttag.version']=versionArray[0] + '.' + versionArray[1] + "-STAGING-latest"; |
| 48 | } |
| 49 | |
| 50 | println 'New Tag for docker:' + |
| 51 | project.properties['project.docker.latesttag.version']; |
| 52 | </source> |
| 53 | </configuration> |
| 54 | </execution> |
| 55 | </executions> |
| 56 | </plugin> |
| 57 | |
| 58 | <plugin> |
| 59 | <artifactId>maven-resources-plugin</artifactId> |
| 60 | <version>2.6</version> |
| 61 | <executions> |
| 62 | <execution> |
| 63 | <id>copy-dockerfile</id> |
| 64 | <goals> |
| 65 | <goal>copy-resources</goal> |
| 66 | </goals><!-- here the phase you need --> |
| 67 | <phase>validate</phase> |
| 68 | <configuration> |
| 69 | <outputDirectory>${basedir}/target/docker-stage</outputDirectory> |
| 70 | <resources> |
| 71 | <resource> |
| 72 | <directory>src/main/docker</directory> |
| 73 | <includes> |
| 74 | <include>Dockerfile</include> |
| 75 | </includes> |
| 76 | <filtering>true</filtering> |
| 77 | </resource> |
| 78 | </resources> |
| 79 | </configuration> |
| 80 | </execution> |
| 81 | </executions> |
| 82 | </plugin> |
| 83 | </plugins> |
| 84 | </build> |
| 85 | |
| 86 | <profiles> |
| 87 | <profile> |
| 88 | <id>docker</id> |
| 89 | <build> |
| 90 | <plugins> |
| 91 | <plugin> |
| 92 | <groupId>io.fabric8</groupId> |
| 93 | <artifactId>docker-maven-plugin</artifactId> |
| 94 | <version>0.26.0</version> |
| 95 | <inherited>false</inherited> |
| 96 | <configuration> |
| 97 | |
| 98 | <images> |
| 99 | <image> |
| 100 | <name>${image.name}</name> |
| 101 | <build> |
| 102 | <cleanup>try</cleanup> |
| 103 | <dockerFileDir>${basedir}/target/docker-stage</dockerFileDir> |
| 104 | <dockerFile>Dockerfile</dockerFile> |
| 105 | <tags> |
| 106 | <tag>${project.version}</tag> |
| 107 | <tag>${project.version}-STAGING-${maven.build.timestamp}</tag> |
| 108 | <tag>${project.docker.latesttag.version}</tag> |
| 109 | </tags> |
| 110 | </build> |
| 111 | </image> |
| 112 | </images> |
| 113 | </configuration> |
| 114 | <executions> |
| 115 | <execution> |
| 116 | <id>generate-images</id> |
| 117 | <phase>generate-sources</phase> |
| 118 | <goals> |
| 119 | <goal>build</goal> |
| 120 | </goals> |
| 121 | </execution> |
| 122 | |
| 123 | <execution> |
| 124 | <id>push-images</id> |
| 125 | <phase>deploy</phase> |
| 126 | <goals> |
| 127 | <goal>build</goal> |
| 128 | <goal>push</goal> |
| 129 | </goals> |
| 130 | </execution> |
| 131 | </executions> |
| 132 | </plugin> |
| 133 | |
| 134 | </plugins> |
| 135 | </build> |
| 136 | </profile> |
| 137 | </profiles> |
| 138 | </project> |