Generate and push docker images 60/12960/2 0.0.1
authoraravind.est <aravindhan.a@est.tech>
Wed, 12 Jun 2024 11:38:45 +0000 (12:38 +0100)
committeraravind.est <aravindhan.a@est.tech>
Wed, 19 Jun 2024 11:54:51 +0000 (12:54 +0100)
Docker image generated and pushed.

Issue-ID: SMO-147
Change-Id: Ie6cc0cfe34bb966cebb9b9b310888880b4d9f5bc
Signed-off-by: aravind.est <aravindhan.a@est.tech>
docker-compose/docker-compose.yml
pom.xml
teiv/exposure.Dockerfile [moved from teiv/Dockerfile with 84% similarity]
teiv/ingestion.Dockerfile [new file with mode: 0644]
teiv/pom.xml

index 051e803..b4763f5 100644 (file)
@@ -43,7 +43,7 @@ services:
 
   topology-exposure-inventory:
     container_name: topology-exposure-inventory
-    image: topology-exposure-inventory:latest
+    image: o-ran-sc/smo-teiv-exposure:latest
     ports:
       - 31074:8080
     depends_on:
@@ -59,9 +59,7 @@ services:
 
   topology-ingestion-inventory:
     container_name: topology-ingestion-inventory
-    image: topology-exposure-inventory:latest
-    environment:
-      - SPRING_PROFILES_ACTIVE=ingestion
+    image: o-ran-sc/smo-teiv-ingestion:latest
     depends_on:
       - dbpostgresql
     deploy:
diff --git a/pom.xml b/pom.xml
index 662f516..8dc1f49 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -92,6 +92,7 @@
         <version.sonar-maven-plugin>3.9.1.2184</version.sonar-maven-plugin>
         <version.antrun-maven-plugin>3.1.0</version.antrun-maven-plugin>
         <version.antlr>4.13.0</version.antlr>
+        <docker-maven-plugin>0.43.4</docker-maven-plugin>
         <!-- JaCoCo plugin for Java Code Coverage -->
         <version.jacoco-maven.plugin>0.8.8</version.jacoco-maven.plugin>
         <!-- Minimum ratio or percentage of instructions to be covered, used by
similarity index 84%
rename from teiv/Dockerfile
rename to teiv/exposure.Dockerfile
index bb6c576..3382c86 100644 (file)
@@ -32,11 +32,11 @@ RUN echo "$USER_ID:!::0:::::" >>/etc/shadow
 ARG USER_NAME="topology-exposure-inventory"
 RUN echo "$USER_ID:x:$USER_ID:0:An Identity for $USER_NAME:/nonexistent:/bin/false" >>/etc/passwd
 
-# TODO version in the jar file should be moved out
-ARG JAR_FILE="target/topology-exposure-inventory-jar-0.0.1-SNAPSHOT.jar"
-ADD $JAR_FILE topology-exposure-inventory-app.jar
+ARG JAR
+WORKDIR /opt/app/teiv
 
-RUN find / -perm /u=s,g=s -type f -exec chmod a-s {} \; || true
+ADD src/main/resources/application.yaml /opt/app/teiv/config/application.yaml
+ADD target/${JAR} /opt/app/teiv/topology-exposure-inventory-app.jar
 
 USER $USER_ID
 
@@ -46,7 +46,7 @@ ARG COMMIT
 ARG BUILD_DATE
 ARG APP_VERSION
 LABEL \
-    org.opencontainers.image.title=topology-exposure-inventory-jsb \
+    org.opencontainers.image.title=topology-exposure-jsb \
     org.opencontainers.image.created=$BUILD_DATE \
     org.opencontainers.image.revision=$COMMIT \
     org.opencontainers.image.vendor=ORAN \
diff --git a/teiv/ingestion.Dockerfile b/teiv/ingestion.Dockerfile
new file mode 100644 (file)
index 0000000..bd2d650
--- /dev/null
@@ -0,0 +1,55 @@
+#
+# ============LICENSE_START=======================================================
+# Copyright (C) 2024 Ericsson
+# Modifications Copyright (C) 2024 OpenInfra Foundation Europe
+# ================================================================================
+# 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=========================================================
+#
+
+FROM debian:bullseye-slim
+
+RUN apt-get update && \
+    apt-get install -y --no-install-recommends \
+    openjdk-17-jdk-headless && \
+    rm -rf /var/lib/apt/lists/*
+
+ARG USER_ID=40514
+RUN echo "$USER_ID:!::0:::::" >>/etc/shadow
+
+ARG USER_NAME="topology-exposure-inventory"
+RUN echo "$USER_ID:x:$USER_ID:0:An Identity for $USER_NAME:/nonexistent:/bin/false" >>/etc/passwd
+
+ARG JAR
+WORKDIR /opt/app/teiv
+
+ENV SPRING_PROFILES_ACTIVE=ingestion
+
+ADD src/main/resources/application.yaml /opt/app/teiv/config/application.yaml
+ADD target/${JAR} /opt/app/teiv/topology-exposure-inventory-app.jar
+
+USER $USER_ID
+
+CMD ["/bin/sh", "-c", "java ${JAVA_OPTS} -jar topology-exposure-inventory-app.jar"]
+
+ARG COMMIT
+ARG BUILD_DATE
+ARG APP_VERSION
+LABEL \
+    org.opencontainers.image.title=topology-ingestion-jsb \
+    org.opencontainers.image.created=$BUILD_DATE \
+    org.opencontainers.image.revision=$COMMIT \
+    org.opencontainers.image.vendor=ORAN \
+    org.opencontainers.image.version=$APP_VERSION
index ae25513..cac4fad 100644 (file)
                     </execution>
                 </executions>
             </plugin>
+            <plugin>
+                <groupId>io.fabric8</groupId>
+                <artifactId>docker-maven-plugin</artifactId>
+                <version>${docker-maven-plugin}</version>
+                <inherited>false</inherited>
+                <executions>
+                    <execution>
+                        <id>build-push-smo-teiv-exposure-image</id>
+                        <goals>
+                            <goal>build</goal>
+                            <goal>push</goal>
+                        </goals>
+                        <configuration>
+                            <pullRegistry>${env.CONTAINER_PULL_REGISTRY}</pullRegistry>
+                            <pushRegistry>${env.CONTAINER_PUSH_REGISTRY}</pushRegistry>
+                            <images>
+                                <image>
+                                    <name>
+                                        o-ran-sc/smo-teiv-exposure:${project.version}
+                                    </name>
+                                    <build>
+                                        <contextDir>${project.basedir}</contextDir>
+                                        <dockerFile>exposure.Dockerfile</dockerFile>
+                                        <args>
+                                            <JAR>${project.build.finalName}.jar</JAR>
+                                        </args>
+                                        <tags>
+                                            <tag>${project.version}</tag>
+                                            <tag>latest</tag>
+                                        </tags>
+                                    </build>
+                                </image>
+                            </images>
+                        </configuration>
+                    </execution>
+                    <execution>
+                        <id>build-push-smo-teiv-ingestion-image</id>
+                        <goals>
+                            <goal>build</goal>
+                            <goal>push</goal>
+                        </goals>
+                        <configuration>
+                            <pullRegistry>${env.CONTAINER_PULL_REGISTRY}</pullRegistry>
+                            <pushRegistry>${env.CONTAINER_PUSH_REGISTRY}</pushRegistry>
+                            <images>
+                                <image>
+                                    <name>
+                                        o-ran-sc/smo-teiv-ingestion:${project.version}
+                                    </name>
+                                    <build>
+                                        <contextDir>${project.basedir}</contextDir>
+                                        <dockerFile>ingestion.Dockerfile</dockerFile>
+                                        <args>
+                                            <JAR>${project.build.finalName}.jar</JAR>
+                                        </args>
+                                        <tags>
+                                            <tag>${project.version}</tag>
+                                            <tag>latest</tag>
+                                        </tags>
+                                    </build>
+                                </image>
+                            </images>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
             <plugin>
                 <groupId>org.springframework.cloud</groupId>
                 <artifactId>spring-cloud-contract-maven-plugin</artifactId>