2 # ============LICENSE_START=======================================================
4 # ================================================================================
5 # Copyright (C) 2023 Nordix Foundation. All rights reserved.
6 # ================================================================================
7 # Licensed under the Apache License, Version 2.0 (the "License");
8 # you may not use this file except in compliance with the License.
9 # You may obtain a copy of the License at
11 # http://www.apache.org/licenses/LICENSE-2.0
13 # Unless required by applicable law or agreed to in writing, software
14 # distributed under the License is distributed on an "AS IS" BASIS,
15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # See the License for the specific language governing permissions and
17 # limitations under the License.
19 # SPDX-License-Identifier: Apache-2.0
20 # ============LICENSE_END=========================================================
23 FROM openjdk:17-jdk as jre-build
25 RUN $JAVA_HOME/bin/jlink \
27 --add-modules ALL-MODULE-PATH \
34 # Use debian base image (same as openjdk uses)
38 ENV PATH="${JAVA_HOME}/bin:${PATH}"
40 #copy JRE from the base image
41 COPY --from=jre-build /customjre $JAVA_HOME
47 WORKDIR /opt/app/pm-producer-service
48 RUN mkdir -p /var/log/pm-producer-service
49 RUN mkdir -p /opt/app/pm-producer-service/etc/cert/
50 RUN mkdir -p /var/pm-producer-service
52 ADD /config/application.yaml /opt/app/pm-producer-service/config/application.yaml
53 ADD /config/application_configuration.json /opt/app/pm-producer-service/data/application_configuration.json_example
54 ADD /config/keystore.jks /opt/app/pm-producer-service/etc/cert/keystore.jks
55 ADD /config/truststore.jks /opt/app/pm-producer-service/etc/cert/truststore.jks
60 RUN groupadd $user && \
61 useradd -r -g $group $user
62 RUN chown -R $user:$group /opt/app/pm-producer-service
63 RUN chown -R $user:$group /var/log/pm-producer-service
64 RUN chown -R $user:$group /var/pm-producer-service
68 ADD target/${JAR} /opt/app/pm-producer-service/pmproducer.jar
69 CMD ["/jre/bin/java", "-jar", "/opt/app/pm-producer-service/pmproducer.jar"]