67a73bbeeedfa84da82c25e73c44fef8dc6d671a
[policy/api.git] / packages / policy-api-docker / src / main / docker / suse.Dockerfile
1 #-------------------------------------------------------------------------------
2 # Dockerfile
3 # ============LICENSE_START=======================================================
4 #  Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved.
5 #  Modifications Copyright (C) 2022 Bell Canada. All rights reserved.
6 #  Modifications Copyright (C) 2022 Nordix Foundation.
7 # ================================================================================
8 # Licensed under the Apache License, Version 2.0 (the "License");
9 # you may not use this file except in compliance with the License.
10 # You may obtain a copy of the License at
11 #
12 #      http://www.apache.org/licenses/LICENSE-2.0
13 #
14 # Unless required by applicable law or agreed to in writing, software
15 # distributed under the License is distributed on an "AS IS" BASIS,
16 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 # See the License for the specific language governing permissions and
18 # limitations under the License.
19 #
20 # SPDX-License-Identifier: Apache-2.0
21 # ============LICENSE_END=========================================================
22 #-------------------------------------------------------------------------------
23 FROM opensuse/leap:15.3
24
25 LABEL maintainer="Policy Team"
26
27 ARG POLICY_LOGS=/var/log/onap/policy/api
28
29 ENV POLICY_LOGS=$POLICY_LOGS
30 ENV POLICY_HOME=/opt/app/policy/api
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-headless netcat-openbsd tar && \
35     zypper -n -q update && zypper -n -q clean --all && \
36     groupadd --system policy && \
37     useradd --system --shell /bin/sh -G policy policy && \
38     mkdir -p /app $POLICY_LOGS $POLICY_HOME $POLICY_HOME/bin && \
39     chown -R policy:policy /app $POLICY_HOME $POLICY_LOGS && \
40     mkdir /packages
41 COPY /maven/lib/policy-api.tar.gz /packages
42 RUN tar xvfz /packages/policy-api.tar.gz --directory $POLICY_HOME && \
43     rm /packages/policy-api.tar.gz
44
45 WORKDIR $POLICY_HOME
46 COPY policy-api.sh  bin/.
47 COPY /maven/api.jar /app
48
49 RUN chown -R policy:policy * && chmod 755 bin/*.sh && chown -R policy:policy /app
50
51 USER policy
52 WORKDIR $POLICY_HOME/bin
53 ENTRYPOINT [ "./policy-api.sh" ]