OpenSuse docker file for APEX-PDP
[policy/apex-pdp.git] / packages / apex-pdp-docker / src / main / docker / suse.Dockerfile
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
8 #
9 #      http://www.apache.org/licenses/LICENSE-2.0
10 #
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.
16 #
17 # SPDX-License-Identifier: Apache-2.0
18 # ============LICENSE_END=========================================================
19 #-------------------------------------------------------------------------------
20
21 #
22 # Docker file to build an image that runs APEX on Java 11 or better in OpenSuse
23 #
24 FROM opensuse/leap:15.3
25
26 LABEL maintainer="Policy Team"
27
28 ARG POLICY_LOGS=/var/log/onap/policy/apex-pdp
29 ENV POLICY_HOME=/opt/app/policy/apex-pdp
30 ENV POLICY_LOGS=$POLICY_LOGS
31 ENV LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=en_US.UTF-8
32 ENV JAVA_HOME=/usr/lib64/jvm/java-11-openjdk-11
33
34 RUN zypper -n -q install --no-recommends gzip java-11-openjdk-devel netcat-openbsd tar \
35     && zypper -n -q update && zypper -n -q clean --all \
36     && groupadd --system apexuser && useradd --system --shell /bin/sh -G apexuser apexuser \
37     && mkdir -p $POLICY_HOME \
38     && mkdir -p $POLICY_LOGS \
39     && chown -R apexuser:apexuser $POLICY_HOME $POLICY_LOGS \
40     && mkdir /packages
41
42 COPY /maven/apex-pdp-package-full.tar.gz /packages
43 RUN tar xvfz /packages/apex-pdp-package-full.tar.gz --directory $POLICY_HOME \
44     && rm /packages/apex-pdp-package-full.tar.gz \
45     && find /opt/app -type d -perm 755 \
46     && find /opt/app -type f -perm 644 \
47     && chmod 755 $POLICY_HOME/bin/* \
48     && cp -pr $POLICY_HOME/examples /home/apexuser \
49     && chown -R apexuser:apexuser /home/apexuser/* $POLICY_HOME \
50     && chmod 755 $POLICY_HOME/etc/*
51
52 USER apexuser
53 ENV PATH $POLICY_HOME/bin:$PATH
54 WORKDIR /home/apexuser
55 ENTRYPOINT [ "/bin/sh" ]