Fix simulator OpenSuse docker file
[policy/models.git] / models-sim / packages / models-simulator-docker / src / main / docker / suse.Dockerfile
1 #
2 # ============LICENSE_START=======================================================
3 # ONAP
4 # ================================================================================
5 # Copyright (C) 2022 Nordix Foundation.
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
23 FROM opensuse/leap:15.3
24
25 LABEL maintainer="Policy Team"
26 LABEL org.opencontainers.image.title="Policy Models Simulator"
27 LABEL org.opencontainers.image.description="Policy Models Simulator image based on OpenSuse"
28 LABEL org.opencontainers.image.url="https://github.com/onap/policy-models"
29 LABEL org.opencontainers.image.vendor="ONAP Policy Team"
30 LABEL org.opencontainers.image.licenses="Apache-2.0"
31 LABEL org.opencontainers.image.created="${git.build.time}"
32 LABEL org.opencontainers.image.version="${git.build.version}"
33 LABEL org.opencontainers.image.revision="${git.commit.id.abbrev}"
34
35 ARG POLICY_LOGS=/var/log/onap/policy/simulators
36
37 ENV POLICY_LOGS=$POLICY_LOGS
38 ENV POLICY_HOME=/opt/app/policy/simulators
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
41
42 RUN zypper -n -q install --no-recommends gzip java-11-openjdk-headless netcat-openbsd tar && \
43     zypper -n -q update; zypper -n -q clean --all && \
44     groupadd --system policy && \
45     useradd --system --shell /bin/sh -G policy policy && \
46     mkdir -p /app $POLICY_LOGS $POLICY_HOME $POLICY_HOME/bin && \
47     chown -R policy:policy /app $POLICY_HOME $POLICY_LOGS && \
48     mkdir /packages
49 COPY /maven/lib/models-simulator.tar.gz /packages
50
51 RUN tar xvfz /packages/models-simulator.tar.gz --directory ${POLICY_HOME} \
52     && rm /packages/models-simulator.tar.gz
53
54 WORKDIR $POLICY_HOME
55 COPY simulators.sh bin/.
56
57 RUN chown -R policy:policy * && chmod 755 bin/*.sh && chown -R policy:policy /app
58
59 USER policy
60 WORKDIR $POLICY_HOME/bin
61 ENTRYPOINT [ "./simulators.sh" ]