blob: fea4ba5092c3d3166b123515162ef5203618f69b [file] [log] [blame]
PatrikBuhr9e3ded92023-03-07 13:16:43 +01001#
2# ============LICENSE_START=======================================================
3# O-RAN-SC
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
10#
11# http://www.apache.org/licenses/LICENSE-2.0
12#
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.
18#
19# SPDX-License-Identifier: Apache-2.0
20# ============LICENSE_END=========================================================
21
22
BjornMagnussonXAb23556b2023-03-20 23:37:17 +010023FROM openjdk:17-jdk as jre-build
24
25RUN $JAVA_HOME/bin/jlink \
26--verbose \
27--add-modules ALL-MODULE-PATH \
28--strip-debug \
29--no-man-pages \
30--no-header-files \
31--compress=2 \
32--output /customjre
33
34# Use debian base image (same as openjdk uses)
35FROM debian:11-slim
36
37ENV JAVA_HOME=/jre
38ENV PATH="${JAVA_HOME}/bin:${PATH}"
39
40#copy JRE from the base image
41COPY --from=jre-build /customjre $JAVA_HOME
PatrikBuhr9e3ded92023-03-07 13:16:43 +010042
43EXPOSE 8084 8435
44
45ARG JAR
46
47WORKDIR /opt/app/pmlog-service
48RUN mkdir -p /var/log/pmlog-service
49RUN mkdir -p /opt/app/pmlog-service/etc/cert/
50RUN mkdir -p /var/pmlog-service
51
52ADD /config/application.yaml /opt/app/pmlog-service/config/application.yaml
53ADD /config/jobDefinition.json /opt/app/pmlog-service/config/jobDefinition.json
54ADD /config/keystore.jks /opt/app/pmlog-service/etc/cert/keystore.jks
55ADD /config/truststore.jks /opt/app/pmlog-service/etc/cert/truststore.jks
56
57ARG user=nonrtric
58ARG group=nonrtric
59
60RUN groupadd $user && \
61 useradd -r -g $group $user
62RUN chown -R $user:$group /opt/app/pmlog-service
63RUN chown -R $user:$group /var/log/pmlog-service
64RUN chown -R $user:$group /var/pmlog-service
65
66USER ${user}
67
68ADD target/${JAR} /opt/app/pmlog-service/pmlog.jar
BjornMagnussonXAb23556b2023-03-20 23:37:17 +010069CMD ["/jre/bin/java", "-jar", "/opt/app/pmlog-service/pmlog.jar"]