elinuxhenrik | 1cd0f2e | 2022-03-28 09:48:52 +0200 | [diff] [blame] | 1 | # |
| 2 | # ============LICENSE_START======================================================= |
| 3 | # O-RAN-SC |
| 4 | # ================================================================================ |
BjornMagnussonXA | 239919f | 2023-03-20 18:10:36 +0100 | [diff] [blame] | 5 | # Copyright (C) 2021-2023 Nordix Foundation. All rights reserved. |
elinuxhenrik | 1cd0f2e | 2022-03-28 09:48:52 +0200 | [diff] [blame] | 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 | |
BjornMagnussonXA | 239919f | 2023-03-20 18:10:36 +0100 | [diff] [blame] | 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 |
elinuxhenrik | 1cd0f2e | 2022-03-28 09:48:52 +0200 | [diff] [blame] | 42 | |
| 43 | EXPOSE 8084 8435 |
| 44 | |
| 45 | ARG JAR |
| 46 | |
| 47 | WORKDIR /opt/app/dmaap-adapter-service |
| 48 | RUN mkdir -p /var/log/dmaap-adapter-service |
| 49 | RUN mkdir -p /opt/app/dmaap-adapter-service/etc/cert/ |
| 50 | RUN mkdir -p /var/dmaap-adapter-service |
| 51 | |
| 52 | ADD /config/application.yaml /opt/app/dmaap-adapter-service/config/application.yaml |
| 53 | ADD /config/application_configuration.json /opt/app/dmaap-adapter-service/data/application_configuration.json_example |
| 54 | ADD /config/keystore.jks /opt/app/dmaap-adapter-service/etc/cert/keystore.jks |
| 55 | ADD /config/truststore.jks /opt/app/dmaap-adapter-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/dmaap-adapter-service |
| 63 | RUN chown -R $user:$group /var/log/dmaap-adapter-service |
| 64 | RUN chown -R $user:$group /var/dmaap-adapter-service |
| 65 | |
| 66 | USER ${user} |
| 67 | |
| 68 | ADD target/${JAR} /opt/app/dmaap-adapter-service/dmaap-adapter.jar |
BjornMagnussonXA | 239919f | 2023-03-20 18:10:36 +0100 | [diff] [blame] | 69 | CMD ["/jre/bin/java", "-jar", "/opt/app/dmaap-adapter-service/dmaap-adapter.jar"] |