summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pom.xml199
-rw-r--r--src/main/assembly/descriptor.xml36
-rw-r--r--src/main/docker/Dockerfile23
3 files changed, 182 insertions, 76 deletions
diff --git a/pom.xml b/pom.xml
index 741382d..2298416 100644
--- a/pom.xml
+++ b/pom.xml
@@ -19,7 +19,8 @@
limitations under the License.
============LICENSE_END=========================================================
-->
-<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">
+<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">
<modelVersion>4.0.0</modelVersion>
<parent>
@@ -43,6 +44,16 @@
coverage caused by new changes. Note that this figure cannot be lower than the ONAP requirement of 0.55 -->
<jacoco.line.coverage.limit>0.55</jacoco.line.coverage.limit>
<jacoco.report.directory>${project.build.directory}/code-coverage</jacoco.report.directory>
+ <!-- docker related properties -->
+ <docker.fabric.version>0.28.0</docker.fabric.version>
+ <aai.docker.version>1.0.0</aai.docker.version>
+ <aai.build.directory>${project.build.directory}/${project.artifactId}-build/
+ </aai.build.directory>
+ <aai.docker.namespace>onap</aai.docker.namespace>
+ <aai.base.image>alpine</aai.base.image>
+ <aai.base.image.version>1.6.0</aai.base.image.version>
+ <!-- This will be used for the docker images as the default format of maven build has issues -->
+ <maven.build.timestamp.format>yyyyMMdd'T'HHmmss'Z'</maven.build.timestamp.format>
</properties>
<dependencyManagement>
@@ -127,9 +138,9 @@
<version>${event.client.version}</version>
</dependency>
<dependency>
- <groupId>org.onap.aai.event-client</groupId>
- <artifactId>event-client-rabbitmq</artifactId>
- <version>${event.client.version}</version>
+ <groupId>org.onap.aai.event-client</groupId>
+ <artifactId>event-client-rabbitmq</artifactId>
+ <version>${event.client.version}</version>
</dependency>
<dependency>
@@ -226,15 +237,127 @@
<scope>test</scope>
</dependency>
</dependencies>
-
+
+ <profiles>
+ <!-- Docker profile to be used for building docker image and pushing to nexus -->
+ <profile>
+ <id>docker</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <version>3.0.0</version>
+ <executions>
+ <execution>
+ <phase>pre-clean</phase>
+ <id>parse-version</id>
+ <goals>
+ <goal>parse-version</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.groovy.maven</groupId>
+ <artifactId>gmaven-plugin</artifactId>
+ <version>1.0</version>
+ <executions>
+ <execution>
+ <phase>pre-clean</phase>
+ <goals>
+ <goal>execute</goal>
+ </goals>
+ <configuration>
+ <source>
+ def userAaiBaseImage = session.userProperties['aai.base.image']
+ def userAaiCommonVersion = session.userProperties['aai.base.image.version']
+ if (userAaiCommonVersion != null) {
+ project.properties['aai.base.image.version'] = userAaiCommonVersion
+ }
+ if (userAaiBaseImage != null) {
+ project.properties['aai.base.image'] = userAaiBaseImage
+ }
+ log.info 'Base image flavour: ' + project.properties['aai.base.image']
+ log.info 'Base image version: ' + project.properties['aai.base.image.version']
+ </source>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>io.fabric8</groupId>
+ <artifactId>docker-maven-plugin</artifactId>
+ <version>${docker.fabric.version}</version>
+ <configuration>
+ <verbose>true</verbose>
+ <apiVersion>1.23</apiVersion>
+ <images>
+ <image>
+ <name>${docker.push.registry}/${aai.docker.namespace}/${project.artifactId}:%l
+ </name>
+ <build>
+ <filter>@</filter>
+ <tags>
+ <tag>latest</tag>
+ <tag>${parsedVersion.majorVersion}.${parsedVersion.minorVersion}-STAGING-latest</tag>
+ <tag>${parsedVersion.majorVersion}.${parsedVersion.minorVersion}-STAGING-${maven.build.timestamp}</tag>
+ </tags>
+ <cleanup>try</cleanup>
+ <dockerFileDir>${project.basedir}/src/main/docker</dockerFileDir>
+ <assembly>
+ <inline>
+ <fileSets>
+ <fileSet>
+ <directory>${aai.build.directory}</directory>
+ <outputDirectory>/${project.artifactId}</outputDirectory>
+ </fileSet>
+ </fileSets>
+ </inline>
+ </assembly>
+ </build>
+ </image>
+ </images>
+ </configuration>
+ <executions>
+ <execution>
+ <id>clean-images</id>
+ <phase>pre-clean</phase>
+ <goals>
+ <goal>remove</goal>
+ </goals>
+ <configuration>
+ <removeAll>true</removeAll>
+ </configuration>
+ </execution>
+ <execution>
+ <id>generate-images</id>
+ <phase>package</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>
+ </profile>
+ </profiles>
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-deploy-plugin</artifactId>
- </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-deploy-plugin</artifactId>
+ </plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
@@ -247,45 +370,23 @@
</execution>
</executions>
</plugin>
-
<plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-resources-plugin</artifactId>
- <version>2.7</version>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <configuration>
+ <descriptors>
+ <descriptor>src/main/assembly/descriptor.xml</descriptor>
+ </descriptors>
+ </configuration>
<executions>
<execution>
- <id>copy-docker-file</id>
+ <id>make-assembly</id>
<phase>package</phase>
<goals>
- <goal>copy-resources</goal>
+ <goal>single</goal>
</goals>
- <configuration>
- <outputDirectory>target</outputDirectory>
- <overwrite>true</overwrite>
- <resources>
- <resource>
- <directory>${basedir}/src/main/docker</directory>
- <filtering>true</filtering>
- <includes>
- <include>**/*</include>
- </includes>
- </resource>
- <resource>
- <directory>${basedir}</directory>
- <filtering>true</filtering>
- <includes>
- <include>bundleconfig-local/**</include>
- </includes>
- </resource>
- <resource>
- <directory>${basedir}/src/main/bin/</directory>
- </resource>
- </resources>
- </configuration>
</execution>
</executions>
</plugin>
-
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
@@ -314,7 +415,6 @@
</execution>
</executions>
</plugin>
-
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
@@ -333,30 +433,13 @@
<version>${version.aai-schema}</version>
<type>jar</type>
<includes>onap/**/</includes>
- <outputDirectory>${project.build.directory}/bundleconfig-local/etc</outputDirectory>
+ <outputDirectory>${aai.build.directory}/bundleconfig/etc</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
-
- <plugin>
- <groupId>com.spotify</groupId>
- <artifactId>docker-maven-plugin</artifactId>
- <version>0.4.11</version>
- <configuration>
- <verbose>true</verbose>
- <serverId>docker-hub</serverId>
- <imageName>${docker.push.registry}/onap/${project.artifactId}</imageName>
- <dockerDirectory>${docker.location}</dockerDirectory>
- <imageTags>
- <imageTag>latest</imageTag>
- </imageTags>
- <forceTags>true</forceTags>
- </configuration>
- </plugin>
-
<plugin>
<groupId>com.mycila</groupId>
<artifactId>license-maven-plugin</artifactId>
diff --git a/src/main/assembly/descriptor.xml b/src/main/assembly/descriptor.xml
new file mode 100644
index 0000000..2a1a2e7
--- /dev/null
+++ b/src/main/assembly/descriptor.xml
@@ -0,0 +1,36 @@
+<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
+ <id>build</id>
+ <includeBaseDirectory>false</includeBaseDirectory>
+ <formats>
+ <format>dir</format>
+ </formats>
+ <fileSets>
+ <fileSet>
+ <directory>${project.basedir}/bundleconfig-local</directory>
+ <outputDirectory>/bundleconfig</outputDirectory>
+ <includes>
+ <include>**/*</include>
+ </includes>
+ </fileSet>
+ <fileSet>
+ <directory>${project.basedir}/src/main/bin</directory>
+ <outputDirectory>/bin</outputDirectory>
+ <includes>
+ <include>**/*</include>
+ </includes>
+ </fileSet>
+ <fileSet>
+ <directory>${project.build.directory}</directory>
+ <outputDirectory>/</outputDirectory>
+ <includes>
+ <include>*.jar</include>
+ </includes>
+ <excludes>
+ <exclude>Dockerfile</exclude>
+ <exclude>*.sh</exclude>
+ </excludes>
+ </fileSet>
+ </fileSets>
+</assembly>
diff --git a/src/main/docker/Dockerfile b/src/main/docker/Dockerfile
index b3d63d7..f96ee9d 100644
--- a/src/main/docker/Dockerfile
+++ b/src/main/docker/Dockerfile
@@ -1,27 +1,14 @@
-FROM ubuntu:14.04
+FROM @aai.docker.namespace@/aai-common-@aai.base.image@:@aai.base.image.version@
ARG MICRO_HOME=/opt/app/spike
ARG BIN_HOME=$MICRO_HOME/bin
-RUN apt-get update
-
-# Install and setup java8
-RUN apt-get update && apt-get install -y software-properties-common
-## sudo -E is required to preserve the environment. If you remove that line, it will most like freeze at this step
-RUN sudo -E add-apt-repository ppa:openjdk-r/ppa && apt-get update && apt-get install -y openjdk-8-jdk
-## Setup JAVA_HOME, this is useful for docker commandline
-ENV JAVA_HOME usr/lib/jvm/java-8-openjdk-amd64
-RUN export JAVA_HOME
-
# Build up the deployment folder structure
RUN mkdir -p $MICRO_HOME
-COPY spike.jar $MICRO_HOME/
-RUN mkdir -p $BIN_HOME
-COPY *.sh $BIN_HOME
-RUN mkdir -p $MICRO_HOME/bundleconfig/etc
-COPY bundleconfig-local $MICRO_HOME/bundleconfig
-RUN chmod 755 $BIN_HOME/*
-RUN ln -s /logs $MICRO_HOME/logs
+WORKDIR $MICRO_HOME
+COPY /maven/spike .
+RUN chmod 755 $BIN_HOME/* \
+ && ln -snf /logs $MICRO_HOME/logs
EXPOSE 9518 9518