Update to JDK 17 & Springboot 3
Change-Id: I6bb4a20da81f16ede57ba576021e8f14b327927c
Signed-off-by: JohnKeeney <john.keeney@est.tech>
Issue-ID: NONRTRIC-841
diff --git a/Dockerfile b/Dockerfile
index b50767c..bf64aae 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -15,7 +15,7 @@
# ============LICENSE_END=================================================
#
-FROM curlimages/curl:7.78.0 AS build
+FROM curlimages/curl:7.78.0 AS base-build
#Get helm
RUN curl -Lo /tmp/helm.tar.gz https://get.helm.sh/helm-v3.6.1-linux-amd64.tar.gz
@@ -23,22 +23,36 @@
#Get kubectl
RUN curl -Lo /tmp/kubectl https://dl.k8s.io/release/v1.20.2/bin/linux/amd64/kubectl
+#Get JDK & shrink it to equivalent to a JRE
+FROM openjdk:17-jdk as jre-build
-FROM openjdk:11-jre-slim
+RUN $JAVA_HOME/bin/jlink \
+ --verbose \
+ --add-modules ALL-MODULE-PATH \
+ --strip-debug \
+ --no-man-pages \
+ --no-header-files \
+ --compress=2 \
+ --output /customjre
-#Install helm
-COPY --from=build /tmp/helm.tar.gz .
+# Use debian base image (same as openjdk uses)
+FROM debian:11-slim
-RUN tar -zxvf helm.tar.gz
+#Install helm from base-build image
+COPY --from=base-build /tmp/helm.tar.gz .
+RUN tar -zxvf helm.tar.gz && \
+ mv linux-amd64/helm /usr/local/bin/helm
-RUN mv linux-amd64/helm /usr/local/bin/helm
+#Install kubectl from base-build image
+COPY --from=base-build /tmp/kubectl .
+RUN chmod +x ./kubectl && \
+ mv ./kubectl /usr/local/bin/kubectl
-#Install kubectl
-COPY --from=build /tmp/kubectl .
+#Copy JRE from the jre-base image
+ENV JAVA_HOME=/jre
+ENV PATH=${JAVA_HOME}/bin:${PATH}
+COPY --from=jre-build /customjre $JAVA_HOME
-RUN chmod +x ./kubectl
-
-RUN mv ./kubectl /usr/local/bin/kubectl
WORKDIR /etc/app/helm-manager
COPY config/application.yaml .
@@ -50,15 +64,15 @@
ARG group=nonrtric
RUN groupadd $group && \
- useradd -r -g $group $user
-RUN chown -R $user:$group /opt/app/helm-manager
-RUN chown -R $user:$group /etc/app/helm-manager
+ useradd -r -g $group $user && \
+ chown -R $user:$group /opt/app/helm-manager && \
+ chown -R $user:$group /etc/app/helm-manager
-RUN mkdir /var/helm-manager-service
-RUN chown -R $user:$group /var/helm-manager-service
+RUN mkdir /var/helm-manager-service && \
+ chown -R $user:$group /var/helm-manager-service
-RUN mkdir /home/$user
-RUN chown -R $user:$group /home/$user
+RUN mkdir /home/$user && \
+ chown -R $user:$group /home/$user
USER $user
diff --git a/pom.xml b/pom.xml
index 79291a2..d7b41ca 100644
--- a/pom.xml
+++ b/pom.xml
@@ -26,7 +26,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
- <version>2.6.2</version>
+ <version>3.0.4</version>
<relativePath />
</parent>
<groupId>org.o-ran-sc.nonrtric.plt</groupId>
@@ -49,7 +49,7 @@
<properties>
<!-- Update this when a new version of the dependency jar shall be included -->
<policy-clamp-participant-impl-kubernetes.version>6.1.2</policy-clamp-participant-impl-kubernetes.version>
- <docker-maven-plugin.version>0.36.0</docker-maven-plugin.version>
+ <docker-maven-plugin.version>0.42.0</docker-maven-plugin.version>
</properties>
<dependencies>
<dependency>
@@ -105,9 +105,9 @@
<image>
<name>o-ran-sc/nonrtric-plt-helmmanager:${project.version}</name>
<build>
- <cleanup>try</cleanup>
<contextDir>${basedir}</contextDir>
<dockerFile>Dockerfile</dockerFile>
+ <filter>false</filter>
<tags>
<tag>${project.version}</tag>
</tags>
@@ -131,6 +131,7 @@
<build>
<contextDir>${basedir}</contextDir>
<dockerFile>Dockerfile</dockerFile>
+ <filter>false</filter>
<tags>
<tag>${project.version}</tag>
<tag>latest</tag>