summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukasz Rajewski <lukasz.rajewski@t-mobile.pl>2022-10-27 08:17:20 +0000
committerGerrit Code Review <gerrit@onap.org>2022-10-27 08:17:20 +0000
commit5ce930d4a9e8137b1fbac98a58ebe2cfd3e6a77e (patch)
tree64ff45d8f383c5b89c53f49790d512ab46587d46
parentae696fb66a796f07170565758ef6541e88e8231d (diff)
parent347b1c864daea16f2f25bd4aafee6dc3a3ee13cb (diff)
Merge "Dockerizing simulators"
-rw-r--r--pom.xml99
-rw-r--r--src/main/docker/docker-files/Dockerfile12
-rw-r--r--src/main/docker/docker-files/startup.sh21
3 files changed, 130 insertions, 2 deletions
diff --git a/pom.xml b/pom.xml
index 7ee264d..d88e593 100644
--- a/pom.xml
+++ b/pom.xml
@@ -23,6 +23,9 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
+ <docker.registry>nexus3.onap.org:10001</docker.registry>
+ <docker.image.version>1.0.0</docker.image.version>
+ <versions.jackson>2.8.9</versions.jackson>
</properties>
<dependencies>
@@ -59,6 +62,11 @@
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
+ <dependency>
+ <groupId>javax.xml.bind</groupId>
+ <artifactId>jaxb-api</artifactId>
+ <version>2.3.1</version>
+ </dependency>
</dependencies>
@@ -70,6 +78,93 @@
</plugin>
</plugins>
</build>
-
-
+ <profiles>
+ <profile>
+ <id>docker</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-resources-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>copy-jar</id>
+ <phase>verify</phase>
+ <goals>
+ <goal>copy-resources</goal>
+ </goals>
+ <configuration>
+ <outputDirectory>${basedir}/src/main/docker/docker-files</outputDirectory>
+ <overwrite>true</overwrite>
+ <resources>
+ <resource>
+ <directory>${basedir}/target</directory>
+ <includes>
+ <include>simulator-${project.version}.jar</include>
+ </includes>
+ </resource>
+ </resources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>io.fabric8</groupId>
+ <artifactId>docker-maven-plugin</artifactId>
+ <version>0.28.0</version>
+ <configuration>
+ <verbose>true</verbose>
+ <apiVersion>1.23</apiVersion>
+ <registry>${docker.registry}</registry>
+ <images>
+ <image>
+ <name>core-nssmf-simulator</name>
+ <build>
+ <cleanup>try</cleanup>
+ <dockerFileDir>docker-files</dockerFileDir>
+ <dockerFile>Dockerfile</dockerFile>
+ <tags>
+ <tag>${docker.image.version}</tag>
+ </tags>
+ </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>verify</phase>
+ <goals>
+ <goal>build</goal>
+ </goals>
+ </execution>
+ <!-- <execution>
+ <id>push-images</id>
+ <phase>deploy</phase>
+ <goals>
+ <goal>push</goal>
+ </goals>
+ <configuration>
+ <image>core-nssmf-simulator</image>
+ </configuration>
+ </execution>-->
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
</project>
diff --git a/src/main/docker/docker-files/Dockerfile b/src/main/docker/docker-files/Dockerfile
new file mode 100644
index 0000000..08b55a3
--- /dev/null
+++ b/src/main/docker/docker-files/Dockerfile
@@ -0,0 +1,12 @@
+FROM onap/integration-java11:10.0.0
+
+WORKDIR /home/onap
+
+USER onap
+
+COPY --chown=onap:onap simulator-0.0.1-SNAPSHOT.jar /home/onap/simulator-0.0.1-SNAPSHOT.jar
+COPY --chown=onap:onap startup.sh /home/onap/startup.sh
+
+RUN chmod 700 /home/onap/startup.sh
+
+ENTRYPOINT [ "sh", "-c", "/home/onap/startup.sh"]
diff --git a/src/main/docker/docker-files/startup.sh b/src/main/docker/docker-files/startup.sh
new file mode 100644
index 0000000..63b6f03
--- /dev/null
+++ b/src/main/docker/docker-files/startup.sh
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+# ============LICENSE_START=======================================================
+# Copyright (C) 2022 AT&T Intellectual Property.
+# ================================================================================
+# 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.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+
+java -jar /home/onap/simulator-0.0.1-SNAPSHOT.jar --spring.config.location=/home/onap/app/application.properties