Redesign CCSDK alpine image creation 51/140051/3
authorDan Timoney <dtimoney@att.com>
Fri, 7 Feb 2025 19:24:23 +0000 (14:24 -0500)
committerDan Timoney <dtimoney@att.com>
Mon, 10 Feb 2025 19:47:47 +0000 (14:47 -0500)
Combined creation of CCSDK base images into one pom and one Dockerfile,
and create images for java11, java17 and java21

Issue-ID: CCSDK-4086
Signed-off-by: Dan Timoney <dtimoney@att.com>
Change-Id: I6daa42fbcd451df207fc31750687250a1664b764

13 files changed:
alpine/java11/pom.xml [deleted file]
alpine/java11/src/main/docker/Dockerfile [deleted file]
alpine/java17/pom.xml [deleted file]
alpine/java17/src/main/docker/Dockerfile [deleted file]
alpine/pom.xml
alpine/src/main/docker/Dockerfile [new file with mode: 0644]
alpine/src/main/resources/README-custom-certs.md [moved from alpine/java17/src/main/resources/README-custom-certs.md with 100% similarity]
dgbuilder-docker/src/main/docker/Dockerfile
odlsli/src/main/dc/docker-compose.yaml
opendaylight/argon/argon-alpine/pom.xml
opendaylight/chlorine/chlorine-alpine/pom.xml
src/main/yaml/docker-compose.yml
ubuntu/pom.xml

diff --git a/alpine/java11/pom.xml b/alpine/java11/pom.xml
deleted file mode 100644 (file)
index dda0761..0000000
+++ /dev/null
@@ -1,116 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<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>
-        <groupId>org.onap.ccsdk.distribution</groupId>
-        <artifactId>distribution-alpine-root</artifactId>
-        <version>2.1.0-SNAPSHOT</version>
-    </parent>
-
-    <artifactId>distribution-j11-alpine</artifactId>
-    <packaging>pom</packaging>
-
-    <name>ccsdk-distribution :: alpine :: java11</name>
-    <description>Creates base alpine Docker container</description>
-    <organization>
-        <name>openECOMP</name>
-    </organization>
-
-    <properties>
-        <image.name>onap/ccsdk-alpine-j11-image</image.name>
-        <base.image>onap/integration-java11</base.image>
-        <base.image.version>12.0.0</base.image.version>
-    </properties>
-
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.codehaus.gmaven</groupId>
-                <artifactId>groovy-maven-plugin</artifactId>
-                <version>2.1.1</version>
-                <executions>
-                    <execution>
-                        <phase>validate</phase>
-                        <goals>
-                            <goal>execute</goal>
-                        </goals>
-                        <configuration>
-                            <source>${basedir}/../../src/main/scripts/TagVersion.groovy</source>
-                        </configuration>
-                    </execution>
-                </executions>
-            </plugin>
-            <plugin>
-                <artifactId>maven-resources-plugin</artifactId>
-                <version>2.6</version>
-                <executions>
-                    <execution>
-                        <id>copy-dockerfile</id>
-                        <goals>
-                            <goal>copy-resources</goal>
-                        </goals><!-- here the phase you need -->
-                        <phase>validate</phase>
-                        <configuration>
-                            <outputDirectory>${basedir}/target/docker-stage</outputDirectory>
-                            <resources>
-                                <resource>
-                                    <directory>src/main/docker</directory>
-                                    <includes>
-                                        <include>Dockerfile</include>
-                                    </includes>
-                                    <filtering>true</filtering>
-                                </resource>
-                            </resources>
-                        </configuration>
-                    </execution>
-                </executions>
-            </plugin>
-        </plugins>
-    </build>
-
-    <profiles>
-        <profile>
-            <id>docker</id>
-            <build>
-                <plugins>
-                    <plugin>
-                        <groupId>io.fabric8</groupId>
-                        <artifactId>docker-maven-plugin</artifactId>
-                        <version>0.34.0</version>
-                        <inherited>false</inherited>
-                        <configuration>
-                            <images>
-                                <image>
-                                    <name>${image.name}</name>
-                                    <build>
-                                        <cleanup>try</cleanup>
-                                        <noCache>true</noCache>
-                                        <contextDir>${basedir}/target/docker-stage</contextDir>
-                                        <dockerFile>Dockerfile</dockerFile>
-                                        <tags>
-                                            <tag>${project.docker.latestminortag.version}</tag>
-                                            <tag>${project.docker.latestfulltag.version}</tag>
-                                            <tag>${project.docker.latesttagtimestamp.version}</tag>
-                                        </tags>
-                                    </build>
-                                </image>
-                            </images>
-                            <verbose>${docker.verbose}</verbose>
-                            <skipPush>${docker.skip.push}</skipPush>
-                        </configuration>
-                        <executions>
-                            <execution>
-                                <id>build-push-images</id>
-                                <goals>
-                                    <goal>build</goal>
-                                    <goal>push</goal>
-                                </goals>
-                            </execution>
-                        </executions>
-                    </plugin>
-                </plugins>
-            </build>
-        </profile>
-    </profiles>
-</project>
diff --git a/alpine/java11/src/main/docker/Dockerfile b/alpine/java11/src/main/docker/Dockerfile
deleted file mode 100644 (file)
index 192d618..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-# Base alpine with added packages needed for open ecomp
-FROM ${base.image}:${base.image.version}
-MAINTAINER CCSDK  Team (onap-ccsdk@lists.onap.org)
-USER root
-
-ARG HTTP_PROXY
-ARG HTTPS_PROXY
-
-ENV HTTP_PROXY  ${HTTP_PROXY}
-ENV http_proxy  ${HTTP_PROXY}
-ENV HTTPS_PROXY ${HTTPS_PROXY}
-ENV https_proxy ${HTTPS_PROXY}
-
-ENV JAVA_HOME /opt/java/openjdk
-
-# Add tools needed for OpenDaylight
-RUN apk update && apk --no-cache add sudo bash iputils openssl git mysql-client nodejs npm python3 py3-pip graphviz unzip rsync nss
-
-USER onap
diff --git a/alpine/java17/pom.xml b/alpine/java17/pom.xml
deleted file mode 100644 (file)
index 0275972..0000000
+++ /dev/null
@@ -1,136 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<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>
-        <groupId>org.onap.ccsdk.distribution</groupId>
-        <artifactId>distribution-alpine-root</artifactId>
-        <version>2.1.0-SNAPSHOT</version>
-    </parent>
-
-    <artifactId>distribution-j17-alpine</artifactId>
-    <packaging>pom</packaging>
-
-    <name>ccsdk-distribution :: alpine :: java17</name>
-    <description>Creates base alpine Docker container</description>
-    <organization>
-        <name>openECOMP</name>
-    </organization>
-
-    <properties>
-        <image.name>onap/ccsdk-alpine-j17-image</image.name>
-        <base.image>onap/integration-java17</base.image>
-        <base.image.version>12.0.0</base.image.version>
-    </properties>
-
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.codehaus.gmaven</groupId>
-                <artifactId>groovy-maven-plugin</artifactId>
-                <version>2.1.1</version>
-                <executions>
-                    <execution>
-                        <phase>validate</phase>
-                        <goals>
-                            <goal>execute</goal>
-                        </goals>
-                        <configuration>
-                            <source>${basedir}/../../src/main/scripts/TagVersion.groovy</source>
-                        </configuration>
-                    </execution>
-                </executions>
-            </plugin>
-            <plugin>
-                <artifactId>maven-resources-plugin</artifactId>
-                <version>2.6</version>
-                <executions>
-                    <execution>
-                        <id>copy-dockerfile</id>
-                        <goals>
-                            <goal>copy-resources</goal>
-                        </goals><!-- here the phase you need -->
-                        <phase>validate</phase>
-                        <configuration>
-                            <outputDirectory>${basedir}/target/docker-stage</outputDirectory>
-                            <resources>
-                                <resource>
-                                    <directory>src/main/docker</directory>
-                                    <includes>
-                                        <include>Dockerfile</include>
-                                    </includes>
-                                    <filtering>true</filtering>
-                                </resource>
-                            </resources>
-                        </configuration>
-                    </execution>
-                    <execution>
-                        <id>copy-certificates</id>
-                        <goals>
-                            <goal>copy-resources</goal>
-                        </goals><!-- here the phase you need -->
-                        <phase>validate</phase>
-                        <configuration>
-                            <outputDirectory>${basedir}/target/docker-stage</outputDirectory>
-                            <resources>
-                                <resource>
-                                    <directory>src/main/resources</directory>
-                                    <includes>
-                                        <include>*.pem</include>
-                                        <include>*.md</include>
-                                    </includes>
-                                    <filtering>false</filtering>
-                                </resource>
-                            </resources>
-                        </configuration>
-                    </execution>
-                </executions>
-            </plugin>
-        </plugins>
-    </build>
-
-    <profiles>
-        <profile>
-            <id>docker</id>
-            <build>
-                <plugins>
-                    <plugin>
-                        <groupId>io.fabric8</groupId>
-                        <artifactId>docker-maven-plugin</artifactId>
-                        <version>0.39.0</version>
-                        <inherited>false</inherited>
-                        <configuration>
-                            <images>
-                                <image>
-                                    <name>${image.name}</name>
-                                    <build>
-                                        <cleanup>try</cleanup>
-                                        <noCache>true</noCache>
-                                        <contextDir>${basedir}/target/docker-stage</contextDir>
-                                        <dockerFile>Dockerfile</dockerFile>
-                                        <tags>
-                                            <tag>${project.docker.latestminortag.version}</tag>
-                                            <tag>${project.docker.latestfulltag.version}</tag>
-                                            <tag>${project.docker.latesttagtimestamp.version}</tag>
-                                        </tags>
-                                    </build>
-                                </image>
-                            </images>
-                            <verbose>${docker.verbose}</verbose>
-                            <skipPush>${docker.skip.push}</skipPush>
-                        </configuration>
-                        <executions>
-                            <execution>
-                                <id>build-push-images</id>
-                                <goals>
-                                    <goal>build</goal>
-                                    <goal>push</goal>
-                                </goals>
-                            </execution>
-                        </executions>
-                    </plugin>
-                </plugins>
-            </build>
-        </profile>
-    </profiles>
-</project>
diff --git a/alpine/java17/src/main/docker/Dockerfile b/alpine/java17/src/main/docker/Dockerfile
deleted file mode 100644 (file)
index e1bebd2..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-# Base alpine with added packages needed for open ecomp
-FROM ${base.image}:${base.image.version}
-MAINTAINER CCSDK  Team (onap-ccsdk@lists.onap.org)
-USER root
-
-ARG HTTP_PROXY
-ARG HTTPS_PROXY
-ARG NO_PROXY
-
-ENV HTTP_PROXY ${HTTP_PROXY}
-ENV http_proxy ${HTTP_PROXY}
-ENV HTTPS_PROXY ${HTTPS_PROXY}
-ENV https_proxy ${HTTPS_PROXY}
-ENV NO_PROXY ${NO_PROXY}
-ENV no_proxy ${NO_PROXY}
-
-ENV JAVA_HOME /opt/java/openjdk
-
-# Copy any certs
-COPY *.md *.pem /etc/ssl/certs/
-
-# Install certs
-RUN update-ca-certificates
-
-RUN echo "http_proxy = $http_proxy" && echo "https_proxy = $https_proxy" && echo "no_proxy = $no_proxy" &&  echo "HTTP_PROXY = $HTTP_PROXY" &&  echo "HTTPS_PROXY = $HTTPS_PROXY" && echo "NO_PROXY = $NO_PROXY"
-
-# Add tools needed for OpenDaylight
-RUN apk update && apk --no-cache add sudo bash iputils openssl git mysql-client nodejs npm python3 py3-pip graphviz unzip rsync nss
-
-USER onap
index c31491c..77d39e9 100644 (file)
     <name>ccsdk-distribution :: alpine</name>
     <description>Creates OpenDaylight container</description>
 
-    <modules>
-        <module>java11</module>
-        <module>java17</module>
-    </modules>
+    <properties>
+        <openjdk.image>eclipse-temurin</openjdk.image>
+        <openjdk.additional.packages>sudo bash iputils openssl git mysql-client nodejs npm python3 py3-pip graphviz unzip rsync nss</openjdk.additional.packages>
+        <alpinej21.image.name>onap/ccsdk-alpine-j21-image</alpinej21.image.name>
+        <alpinej17.image.name>onap/ccsdk-alpine-j17-image</alpinej17.image.name>
+        <alpinej11.image.name>onap/ccsdk-alpine-j11-image</alpinej11.image.name>
+        <openjdk21.image.version>21.0.6_7-jre-alpine</openjdk21.image.version>
+        <openjdk17.image.version>17.0.14_7-jre-alpine</openjdk17.image.version>
+        <openjdk11.image.version>11.0.26_4-jre-alpine</openjdk11.image.version>
+    </properties>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.codehaus.gmaven</groupId>
+                <artifactId>groovy-maven-plugin</artifactId>
+                <version>2.1.1</version>
+                <executions>
+                    <execution>
+                        <phase>validate</phase>
+                        <goals>
+                            <goal>execute</goal>
+                        </goals>
+                        <configuration>
+                            <source>${basedir}/../src/main/scripts/TagVersion.groovy</source>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <artifactId>maven-resources-plugin</artifactId>
+                <version>2.6</version>
+                <executions>
+                    <execution>
+                        <id>copy-dockerfile</id>
+                        <goals>
+                            <goal>copy-resources</goal>
+                        </goals><!-- here the phase you need -->
+                        <phase>validate</phase>
+                        <configuration>
+                            <outputDirectory>${basedir}/target/docker-stage</outputDirectory>
+                            <resources>
+                                <resource>
+                                    <directory>src/main/docker</directory>
+                                    <includes>
+                                        <include>Dockerfile</include>
+                                    </includes>
+                                    <filtering>true</filtering>
+                                </resource>
+                            </resources>
+                        </configuration>
+                    </execution>
+                    <execution>
+                        <id>copy-certificates</id>
+                        <goals>
+                            <goal>copy-resources</goal>
+                        </goals><!-- here the phase you need -->
+                        <phase>validate</phase>
+                        <configuration>
+                            <outputDirectory>${basedir}/target/docker-stage</outputDirectory>
+                            <resources>
+                                <resource>
+                                    <directory>src/main/resources</directory>
+                                    <includes>
+                                        <include>*.pem</include>
+                                        <include>*.md</include>
+                                    </includes>
+                                    <filtering>false</filtering>
+                                </resource>
+                            </resources>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+
+
+
+    <profiles>
+        <profile>
+            <id>docker</id>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>io.fabric8</groupId>
+                        <artifactId>docker-maven-plugin</artifactId>
+                        <version>0.39.0</version>
+                        <inherited>false</inherited>
+                        <configuration>
+                            <images>
+                                <image>
+                                    <name>${alpinej21.image.name}</name>
+                                    <build>
+                                        <cleanup>try</cleanup>
+                                        <noCache>true</noCache>
+                                        <contextDir>${basedir}/target/docker-stage</contextDir>
+                                        <dockerFile>Dockerfile</dockerFile>
+                                        <tags>
+                                            <tag>${project.docker.latestminortag.version}</tag>
+                                            <tag>${project.docker.latestfulltag.version}</tag>
+                                            <tag>${project.docker.latesttagtimestamp.version}</tag>
+                                        </tags>
+                                        <args>
+                                            <OPENJDK_IMAGE_VERSION>${openjdk21.image.version}</OPENJDK_IMAGE_VERSION>   
+                                        </args>
+                                    </build>
+                                </image>
+                                <image>
+                                    <name>${alpinej17.image.name}</name>
+                                    <build>
+                                        <cleanup>try</cleanup>
+                                        <noCache>true</noCache>
+                                        <contextDir>${basedir}/target/docker-stage</contextDir>
+                                        <dockerFile>Dockerfile</dockerFile>
+                                        <tags>
+                                            <tag>${project.docker.latestminortag.version}</tag>
+                                            <tag>${project.docker.latestfulltag.version}</tag>
+                                            <tag>${project.docker.latesttagtimestamp.version}</tag>
+                                        </tags>
+                                        <args>
+                                            <OPENJDK_IMAGE_VERSION>${openjdk17.image.version}</OPENJDK_IMAGE_VERSION>   
+                                        </args>
+                                    </build>
+                                </image>
+                                <image>
+                                    <name>${alpinej11.image.name}</name>
+                                    <build>
+                                        <cleanup>try</cleanup>
+                                        <noCache>true</noCache>
+                                        <contextDir>${basedir}/target/docker-stage</contextDir>
+                                        <dockerFile>Dockerfile</dockerFile>
+                                        <tags>
+                                            <tag>${project.docker.latestminortag.version}</tag>
+                                            <tag>${project.docker.latestfulltag.version}</tag>
+                                            <tag>${project.docker.latesttagtimestamp.version}</tag>
+                                        </tags>
+                                        <args>
+                                            <OPENJDK_IMAGE_VERSION>${openjdk11.image.version}</OPENJDK_IMAGE_VERSION>   
+                                        </args>
+                                    </build>
+                                </image>
+                            </images>
+                            <verbose>${docker.verbose}</verbose>
+                            <skipPush>${docker.skip.push}</skipPush>
+                        </configuration>
+                        <executions>
+                            <execution>
+                                <id>build-push-images</id>
+                                <goals>
+                                    <goal>build</goal>
+                                    <goal>push</goal>
+                                </goals>
+                            </execution>
+                        </executions>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+    </profiles>
 </project>
diff --git a/alpine/src/main/docker/Dockerfile b/alpine/src/main/docker/Dockerfile
new file mode 100644 (file)
index 0000000..7e12192
--- /dev/null
@@ -0,0 +1,47 @@
+# Base alpine with added packages needed for open ecomp
+ARG OPENJDK_IMAGE_VERSION
+FROM ${openjdk.image}:${OPENJDK_IMAGE_VERSION}
+
+LABEL maintainer="ONAP CCSDK team"
+LABEL Description="Reference CCSDK JAVA image based on alpine"
+
+# Explicitly become root during build phase
+USER root
+
+ENV JAVA_OPTS="-Xms256m -Xmx1g"
+ENV JAVA_SEC_OPTS=""
+
+ARG HTTP_PROXY=${HTTP_PROXY}
+ARG user=onap
+ARG group=onap
+
+# Install additional tools
+RUN apk add --no-cache openssl ca-certificates
+
+# Copy any certs
+COPY *.md *.pem /etc/ssl/certs/
+
+# Install certs
+RUN update-ca-certificates
+
+# Add additional packages if defined
+RUN test -n "${openjdk.additional.packages}" && \
+    export http_proxy=${HTTP_PROXY} && export https_proxy=${HTTP_PROXY} && \
+    export HTTP_PROXY=${HTTP_PROXY} && export HTTPS_PROXY=${HTTP_PROXY} && \
+    apk update && \
+    apk --no-cache add ${openjdk.additional.packages} && \
+    unset http_proxy && unset https_proxy && unset HTTP_PROXY && unset HTTPS_PROXY \
+    || echo "No additional packages to install"
+
+# Create a group and user
+RUN addgroup -S $group && adduser -G $group -D $user && \
+    mkdir /var/log/$user && \
+    mkdir /app && \
+    chown -R $user:$group /var/log/$user && \
+    chown -R $user:$group /app
+
+# Tell docker that all future commands should be run as the onap user
+USER $user
+WORKDIR /app
+
+ENTRYPOINT exec java $JAVA_SEC_OPTS $JAVA_OPTS -jar /app/app.jar
index a26ed14..9440eaf 100644 (file)
@@ -5,6 +5,7 @@ USER root
 
 RUN addgroup -S dgbuilder && adduser -S dgbuilder -G dgbuilder \
     && apk update && apk --no-cache add curl gcc g++ make ncurses yarn nodejs \
+    && apk upgrade \
     && node --version
 
 COPY --chown=dgbuilder:dgbuilder opt /opt
index 18912f8..e8a6c96 100755 (executable)
@@ -2,7 +2,7 @@ version: '2.1'
 
 services:
   db:
-    image: mariadb:10.5
+    image: mariadb:latest
     container_name: odlsli_db
     ports:
       - "3306"
index 807b6ff..6824734 100644 (file)
                     <plugin>
                         <groupId>io.fabric8</groupId>
                         <artifactId>docker-maven-plugin</artifactId>
-                        <version>0.34.0</version>
+                        <version>0.39.0</version>
                         <inherited>false</inherited>
                         <configuration>
                             <images>
index bb6e3ed..bdf5912 100644 (file)
                     <plugin>
                         <groupId>io.fabric8</groupId>
                         <artifactId>docker-maven-plugin</artifactId>
-                        <version>0.34.0</version>
+                        <version>0.39.0</version>
                         <inherited>false</inherited>
                         <configuration>
                             <images>
index ffe7c7c..10ed82e 100644 (file)
@@ -2,7 +2,7 @@ version: '2.1'
 
 services:
   db:
-    image: mariadb:10.5
+    image: mariadb:latest
     container_name: ccsdk_db_container
     ports:
       - "3306"
index 6dae222..7ec94a8 100644 (file)
@@ -76,7 +76,7 @@
                     <plugin>
                         <groupId>io.fabric8</groupId>
                         <artifactId>docker-maven-plugin</artifactId>
-                        <version>0.34.0</version>
+                        <version>0.39.0</version>
                         <inherited>false</inherited>
                         <configuration>
                             <images>