2 # ============LICENSE_START=======================================================
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
11 # http://www.apache.org/licenses/LICENSE-2.0
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.
19 # SPDX-License-Identifier: Apache-2.0
20 # ============LICENSE_END=========================================================
24 # Docker file to build an image that runs the simulators
27 FROM opensuse/leap:15.3
29 LABEL maintainer="Policy Team"
31 ARG POLICY_LOGS=/var/log/onap/policy/simulators
33 ENV POLICY_LOGS=$POLICY_LOGS
34 ENV POLICY_HOME=/opt/app/policy
35 ENV LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=en_US.UTF-8
36 ENV JAVA_HOME=/usr/lib64/jvm/java-11-openjdk-11
38 # Create DMaaP simulator user and group
39 # Add simulator-specific directories and set ownership as the simulator user
40 RUN zypper -n -q install --no-recommends gzip java-11-openjdk-headless netcat-openbsd tar && \
41 zypper -n -q update; zypper -n -q clean --all && \
42 groupadd --system policy && \
43 useradd --system --shell /bin/sh -G policy policy && \
44 mkdir -p /opt/app $POLICY_LOGS $POLICY_HOME/simulators $POLICY_HOME/simulators/bin && \
45 chown -R policy:policy /opt/app $POLICY_HOME $POLICY_LOGS && \
49 COPY /maven/* /packages
50 RUN tar xvfz /packages/models-simulator.tar.gz --directory ${POLICY_HOME}/simulators \
51 && rm /packages/models-simulator.tar.gz
53 # Ensure everything has the correct permissions
54 # Copy scripts simulator user area
55 COPY simulators.sh ${POLICY_HOME}/simulators/bin
56 RUN find /opt/app -type d -perm 755 \
57 && find /opt/app -type f -perm 644 \
58 && chmod 755 ${POLICY_HOME}/simulators/bin/* \
59 && chown -R policy:policy $POLICY_HOME $POLICY_LOGS
63 ENV PATH ${POLICY_HOME}/simulators/bin:$PATH
64 ENTRYPOINT [ "simulators.sh" ]