aboutsummaryrefslogtreecommitdiffstats
path: root/datarouter-prov
diff options
context:
space:
mode:
authorConor Ward <conor.ward@est.tech>2019-03-21 17:35:28 +0000
committerGerrit Code Review <gerrit@onap.org>2019-03-21 17:35:28 +0000
commit0312e2224f81619699151718622b44db699bcce8 (patch)
tree745b36f9c77f742594f9722a6c610df91550d1ac /datarouter-prov
parent0df559b37da83b4730140f63f0743fae082d4983 (diff)
parentefad46124485f1572765fad05284d8a070fb9277 (diff)
Merge "small, multi-platform docker images"
Diffstat (limited to 'datarouter-prov')
-rwxr-xr-xdatarouter-prov/pom.xml136
-rw-r--r--datarouter-prov/src/main/resources/docker/Dockerfile33
2 files changed, 125 insertions, 44 deletions
diff --git a/datarouter-prov/pom.xml b/datarouter-prov/pom.xml
index cfa41441..44f70f5f 100755
--- a/datarouter-prov/pom.xml
+++ b/datarouter-prov/pom.xml
@@ -26,7 +26,7 @@
<parent>
<groupId>org.onap.dmaap.datarouter</groupId>
<artifactId>parent</artifactId>
- <version>2.0.1-SNAPSHOT</version>
+ <version>2.0.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>datarouter-prov</artifactId>
@@ -41,6 +41,12 @@
<docker.location>${basedir}/target/${artifactId}</docker.location>
<datarouter.prov.image.name>onap/dmaap/datarouter-prov</datarouter.prov.image.name>
+
+ <timestamp>${maven.build.timestamp}</timestamp>
+ <maven.build.timestamp.format>yyyyMMdd'T'HHmmss'Z'</maven.build.timestamp.format>
+
+ <docker.verbose>true</docker.verbose>
+ <docker.apiVersion>1.23</docker.apiVersion>
</properties>
<dependencies>
<dependency>
@@ -264,40 +270,78 @@
</properties>
<build>
<plugins>
+
+ <!-- Setup image tags per https://wiki.onap.org/display/DW/Independent+Versioning+and+Release+Process#IndependentVersioningandReleaseProcess-StandardizedDockerTagging -->
+ <plugin>
+ <groupId>org.codehaus.groovy.maven</groupId>
+ <artifactId>gmaven-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>validate</phase>
+ <goals>
+ <goal>execute</goal>
+ </goals>
+ <configuration>
+ <properties>
+ <ver>${project.version}</ver>
+ <timestamp>${maven.build.timestamp}</timestamp>
+ </properties>
+ <source>
+ println 'ver: ' + project.properties['ver'];
+ if ( project.properties['ver'].endsWith("-SNAPSHOT") ) {
+ project.properties['dockertag1']=project.properties['ver'] + "-latest";
+ project.properties['dockertag2']=project.properties['ver'] + "-" + project.properties['timestamp'];
+ } else {
+ project.properties['dockertag1']=project.properties['ver'] + "-STAGING-latest";
+ project.properties['dockertag2']=project.properties['ver'] + "-STAGING-" + project.properties['timestamp'];
+ }
+ println 'docker tag 1: ' + project.properties['dockertag1'];
+ println 'docker tag 2: ' + project.properties['dockertag2'];
+ </source>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
<plugin>
- <groupId>com.spotify</groupId>
+ <groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
- <version>1.0.0</version>
+ <version>0.28.0</version>
<configuration>
- <imageName>${onap.nexus.dockerregistry.daily}/${datarouter.prov.image.name}</imageName>
- <baseImage>java:8</baseImage>
- <serverId>${onap.nexus.dockerregistry.daily}</serverId>
- <skipDockerBuild>false</skipDockerBuild>
- <imageTags>
- <imageTag>${project.version}</imageTag>
- <imageTag>latest</imageTag>
- </imageTags>
- <forceTags>true</forceTags>
- <entryPoint>["/startup.sh", "start"]</entryPoint>
- <resources>
- <resource>
- <targetPath>/opt</targetPath>
- <directory>${project.build.directory}/opt</directory>
- </resource>
- <resource>
- <targetPath>/</targetPath>
- <directory>${docker.location}</directory>
- <include>startup.sh</include>
- </resource>
- </resources>
- <runs>
- <run>chmod 0700 /startup.sh</run>
- </runs>
- <exposes>
- <expose>8080</expose>
- <expose>8443</expose>
- </exposes>
+ <verbose>${docker.verbose}</verbose>
+ <apiVersion>${docker.apiVersion}</apiVersion>
+ <pullRegistry>${docker.pull.registry}</pullRegistry>
+ <pushRegistry>${docker.push.registry}</pushRegistry>
+ <images>
+ <image>
+ <name>${datarouter.prov.image.name}</name>
+ <build>
+ <cleanup>try</cleanup>
+ <dockerFileDir>${basedir}/target/docker-stage</dockerFileDir>
+ <dockerFile>Dockerfile</dockerFile>
+ <tags>
+ <tag>${dockertag1}</tag>
+ <tag>${dockertag2}</tag>
+ </tags>
+ </build>
+ </image>
+ </images>
</configuration>
+ <executions>
+ <execution>
+ <id>generate-images</id>
+ <phase>install</phase>
+ <goals>
+ <goal>build</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>push-images</id>
+ <phase>deploy</phase>
+ <goals>
+ <goal>push</goal>
+ </goals>
+ </execution>
+ </executions>
</plugin>
</plugins>
</build>
@@ -350,7 +394,7 @@
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
- <outputDirectory>${basedir}/target/opt/app/datartr/lib</outputDirectory>
+ <outputDirectory>${basedir}/target/docker-stage/opt/app/datartr/lib</outputDirectory>
<archive>
<manifest>
<addClasspath>true</addClasspath>
@@ -379,43 +423,47 @@
</configuration>
<version>3.6.0</version>
</plugin>
+
+ <!-- Copy files to docker-stage to be included in image -->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.7</version>
<executions>
<execution>
- <id>copy-docker-file</id>
- <phase>package</phase>
+ <id>copy-dockerfile</id>
+ <phase>validate</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
- <outputDirectory>${docker.location}</outputDirectory>
+ <outputDirectory>${basedir}/target/docker-stage</outputDirectory>
<overwrite>true</overwrite>
<resources>
<resource>
<directory>${basedir}/src/main/resources/docker</directory>
<filtering>true</filtering>
<includes>
- <include>**/*</include>
+ <include>Dockerfile</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
<execution>
- <id>copy-resources-1</id>
+ <id>copy-startup-script</id>
<phase>validate</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
- <outputDirectory>${basedir}/target/opt/app/datartr/lib</outputDirectory>
+ <outputDirectory>${basedir}/target/docker-stage/opt</outputDirectory>
+ <overwrite>true</overwrite>
<resources>
<resource>
- <directory>${project.basedir}/src/main/resources</directory>
+ <directory>${basedir}/src/main/resources/docker</directory>
+ <filtering>true</filtering>
<includes>
- <include>**/*.jar</include>
+ <include>startup.sh</include>
</includes>
</resource>
</resources>
@@ -428,7 +476,7 @@
<goal>copy-resources</goal>
</goals>
<configuration>
- <outputDirectory>${basedir}/target/opt/app/datartr/etc</outputDirectory>
+ <outputDirectory>${basedir}/target/docker-stage/opt/app/datartr/etc</outputDirectory>
<resources>
<resource>
<directory>${basedir}/src/main/resources</directory>
@@ -447,7 +495,7 @@
<goal>copy-resources</goal>
</goals>
<configuration>
- <outputDirectory>${basedir}/target/opt/app/datartr</outputDirectory>
+ <outputDirectory>${basedir}/target/docker-stage/opt/app/datartr</outputDirectory>
<resources>
<resource>
<directory>${basedir}/data</directory>
@@ -466,7 +514,7 @@
<goal>copy-resources</goal>
</goals>
<configuration>
- <outputDirectory>${basedir}/target/opt/app/datartr/aaf_certs</outputDirectory>
+ <outputDirectory>${basedir}/target/docker-stage/opt/app/datartr/aaf_certs</outputDirectory>
<resources>
<resource>
<directory>${basedir}/aaf_certs</directory>
@@ -492,7 +540,7 @@
<goal>copy-dependencies</goal>
</goals>
<configuration>
- <outputDirectory>${project.build.directory}/opt/app/datartr/lib</outputDirectory>
+ <outputDirectory>${basedir}/target/docker-stage/opt/app/datartr/aaf_certs</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>false</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
diff --git a/datarouter-prov/src/main/resources/docker/Dockerfile b/datarouter-prov/src/main/resources/docker/Dockerfile
new file mode 100644
index 00000000..b11925a0
--- /dev/null
+++ b/datarouter-prov/src/main/resources/docker/Dockerfile
@@ -0,0 +1,33 @@
+#########
+# ============LICENSE_START====================================================
+# org.onap.dmaap
+# ===========================================================================
+# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+# Modifications Copyright (C) 2018 Nokia. All rights reserved.
+# ===========================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END====================================================
+#
+FROM openjdk:8-jre-alpine
+
+MAINTAINER DMAAP Team
+
+COPY /opt /opt
+
+RUN apk update && apk add curl
+
+EXPOSE 8080 8443
+
+WORKDIR /opt
+RUN chmod 0700 startup.sh
+ENTRYPOINT ["sh", "startup.sh"]