CI: Add SonarCloud scan GHA workflow
[nonrtric/plt/ranpm.git] / influxlogger / Dockerfile
1 #
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
23 FROM openjdk:17-jdk as jre-build
24
25 RUN $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)
35 FROM debian:11-slim
36
37 ENV JAVA_HOME=/jre
38 ENV PATH="${JAVA_HOME}/bin:${PATH}"
39
40 #copy JRE from the base image
41 COPY --from=jre-build /customjre $JAVA_HOME
42
43 EXPOSE 8084 8435
44
45 ARG JAR
46
47 WORKDIR /opt/app/pmlog-service
48 RUN mkdir -p /var/log/pmlog-service
49 RUN mkdir -p /opt/app/pmlog-service/etc/cert/
50 RUN mkdir -p /var/pmlog-service
51
52 ADD /config/application.yaml /opt/app/pmlog-service/config/application.yaml
53 ADD /config/jobDefinition.json /opt/app/pmlog-service/config/jobDefinition.json
54 ADD /config/keystore.jks /opt/app/pmlog-service/etc/cert/keystore.jks
55 ADD /config/truststore.jks /opt/app/pmlog-service/etc/cert/truststore.jks
56
57 ARG user=nonrtric
58 ARG group=nonrtric
59
60 RUN groupadd $user && \
61     useradd -r -g $group $user
62 RUN chown -R $user:$group /opt/app/pmlog-service
63 RUN chown -R $user:$group /var/log/pmlog-service
64 RUN chown -R $user:$group /var/pmlog-service
65
66 USER ${user}
67
68 ADD target/${JAR} /opt/app/pmlog-service/pmlog.jar
69 CMD ["/jre/bin/java", "-jar", "/opt/app/pmlog-service/pmlog.jar"]