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

© 2017 ONAP. Copyright © The Linux Foundation ®. All Rights Reserved.
The Linux Foundation has registered trademarks and uses trademarks.
For a list of trademarks of The Linux Foundation, please see our Trademark Usage page.
Linux is a registered trademark of Linus Torvalds.
Privacy Policy and Terms of Use