PatrikBuhr | a363dc5 | 2023-03-03 14:02:50 +0100 | [diff] [blame] | 1 | # |
| 2 | # ============LICENSE_START======================================================= |
| 3 | # Copyright (C) 2023 Nordix Foundation. |
| 4 | # Copyright (C) 2020 Nokia. |
| 5 | # Copyright (C) 2021 Samsung Electronics. |
| 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 | # |
BjornMagnussonXA | b23556b | 2023-03-20 23:37:17 +0100 | [diff] [blame^] | 22 | FROM openjdk:17-jdk as jre-build |
| 23 | |
| 24 | RUN $JAVA_HOME/bin/jlink \ |
| 25 | --verbose \ |
| 26 | --add-modules ALL-MODULE-PATH \ |
| 27 | --strip-debug \ |
| 28 | --no-man-pages \ |
| 29 | --no-header-files \ |
| 30 | --compress=2 \ |
| 31 | --output /customjre |
| 32 | |
| 33 | # Use debian base image (same as openjdk uses) |
| 34 | FROM debian:11-slim |
| 35 | |
| 36 | ENV JAVA_HOME=/jre |
| 37 | ENV PATH="${JAVA_HOME}/bin:${PATH}" |
| 38 | |
| 39 | #copy JRE from the base image |
| 40 | COPY --from=jre-build /customjre $JAVA_HOME |
PatrikBuhr | a363dc5 | 2023-03-03 14:02:50 +0100 | [diff] [blame] | 41 | |
| 42 | EXPOSE 8100 8433 |
| 43 | |
| 44 | ARG user=datafile |
| 45 | ARG group=datafile |
| 46 | |
| 47 | USER root |
| 48 | WORKDIR /opt/app/datafile |
| 49 | |
| 50 | ADD /config/application.yaml /opt/app/datafile/config/ |
| 51 | ADD /config/ftps_keystore.pass /opt/app/datafile/config/ |
| 52 | ADD /config/ftps_keystore.p12 /opt/app/datafile/config/ |
| 53 | ADD /config/keystore.jks /opt/app/datafile/config/ |
| 54 | ADD /config/truststore.jks /opt/app/datafile/config/ |
| 55 | ADD /config/truststore.pass /opt/app/datafile/config/ |
| 56 | |
| 57 | |
| 58 | |
| 59 | |
| 60 | RUN mkdir -p /var/log/ONAP /opt/app/datafile/etc/cert/ && \ |
| 61 | addgroup $group && adduser --system --disabled-password --no-create-home --ingroup $group $user && \ |
| 62 | chown -R $user:$group /var/log/ONAP /opt/app/datafile/config && \ |
| 63 | chmod -R u+rw /opt/app/datafile/config/ |
| 64 | |
| 65 | |
| 66 | USER $user |
| 67 | |
| 68 | COPY --chown=$user:$group /target/datafile-app-server.jar /opt/app/datafile/ |
BjornMagnussonXA | b23556b | 2023-03-20 23:37:17 +0100 | [diff] [blame^] | 69 | CMD ["/jre/bin/java", "-jar", "/opt/app/datafile/datafile-app-server.jar"] |