X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=Dockerfile;h=a84b30c15aab0649f2a6fc3d6139fd9dbb5e829a;hb=94fdf4782260c780be3457fe7f11dd9e1a041c02;hp=784664c4ca7d29b250d08fa8b457a8a32dd9b827;hpb=70a2846bc15950b01f14e0c07b6b444e3a735b58;p=nonrtric%2Fplt%2Fa1policymanagementservice.git diff --git a/Dockerfile b/Dockerfile index 784664c..a84b30c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,7 @@ # # ============LICENSE_START======================================================= -# Copyright (C) 2019 Nordix Foundation. +# Copyright (C) 2019-2023 Nordix Foundation. +# Copyright (C) 2024: OpenInfra Foundation Europe. All rights reserved. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,7 +18,25 @@ # SPDX-License-Identifier: Apache-2.0 # ============LICENSE_END========================================================= # -FROM openjdk:17-jdk-slim +FROM openjdk:17-jdk as jre-build + +RUN $JAVA_HOME/bin/jlink \ +--verbose \ +--add-modules ALL-MODULE-PATH \ +--strip-debug \ +--no-man-pages \ +--no-header-files \ +--compress=2 \ +--output /customjre + +# Use debian base image (same as openjdk uses) +FROM debian:11-slim + +ENV JAVA_HOME=/jre +ENV PATH="${JAVA_HOME}/bin:${PATH}" + +# Copy JRE from the base image +COPY --from=jre-build /customjre $JAVA_HOME ARG JAR @@ -27,6 +46,7 @@ EXPOSE 8081 8433 WORKDIR /opt/app/policy-agent RUN mkdir -p /var/log/policy-agent RUN mkdir -p /opt/app/policy-agent/etc/cert/ +RUN mkdir -p /var/policy-management-service EXPOSE 8081 8433 ADD /config/application.yaml /opt/app/policy-agent/config/application.yaml @@ -41,8 +61,9 @@ RUN groupadd $user && \ useradd -r -g $group $user RUN chown -R $user:$group /opt/app/policy-agent RUN chown -R $user:$group /var/log/policy-agent +RUN chown -R $user:$group /var/policy-management-service USER ${user} ADD target/${JAR} /opt/app/policy-agent/policy-agent.jar -CMD ["java", "-jar", "/opt/app/policy-agent/policy-agent.jar"] \ No newline at end of file +CMD ["/jre/bin/java", "-jar", "/opt/app/policy-agent/policy-agent.jar"]