1 #-------------------------------------------------------------------------------
2 # ============LICENSE_START=======================================================
3 # Copyright (C) 2022 Nordix Foundation.
4 # ================================================================================
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
17 # SPDX-License-Identifier: Apache-2.0
18 # ============LICENSE_END=========================================================
19 #-------------------------------------------------------------------------------
22 # Docker file to build an image that runs APEX on Java 11 or better in OpenSuse
24 FROM opensuse/leap:15.4
26 LABEL maintainer="Policy Team"
27 LABEL org.opencontainers.image.title="Policy APEX PDP"
28 LABEL org.opencontainers.image.description="Policy APEX PDP image based on OpenSuse"
29 LABEL org.opencontainers.image.url="https://github.com/onap/policy-apex-pdp"
30 LABEL org.opencontainers.image.vendor="ONAP Policy Team"
31 LABEL org.opencontainers.image.licenses="Apache-2.0"
32 LABEL org.opencontainers.image.created="${git.build.time}"
33 LABEL org.opencontainers.image.version="${git.build.version}"
34 LABEL org.opencontainers.image.revision="${git.commit.id.abbrev}"
36 ARG POLICY_LOGS=/var/log/onap/policy/apex-pdp
37 ENV POLICY_HOME=/opt/app/policy/apex-pdp
38 ENV POLICY_LOGS=$POLICY_LOGS
39 ENV LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=en_US.UTF-8
40 ENV JAVA_HOME=/usr/lib64/jvm/java-11-openjdk-11
42 RUN zypper -n -q install --no-recommends gzip java-11-openjdk-devel netcat-openbsd tar \
43 && zypper -n -q update && zypper -n -q clean --all \
44 && groupadd --system apexuser && useradd --system --shell /bin/sh -G apexuser apexuser \
45 && mkdir -p $POLICY_HOME \
46 && mkdir -p $POLICY_LOGS \
47 && chown -R apexuser:apexuser $POLICY_HOME $POLICY_LOGS \
50 COPY /maven/apex-pdp-package-full.tar.gz /packages
51 RUN tar xvfz /packages/apex-pdp-package-full.tar.gz --directory $POLICY_HOME \
52 && rm /packages/apex-pdp-package-full.tar.gz \
53 && find /opt/app -type d -perm 755 \
54 && find /opt/app -type f -perm 644 \
55 && chmod 755 $POLICY_HOME/bin/* \
56 && cp -pr $POLICY_HOME/examples /home/apexuser \
57 && chown -R apexuser:apexuser /home/apexuser/* $POLICY_HOME \
58 && chmod 755 $POLICY_HOME/etc/*
61 ENV PATH $POLICY_HOME/bin:$PATH
62 WORKDIR /home/apexuser
63 ENTRYPOINT [ "/bin/sh" ]