2 # ============LICENSE_START=======================================================
4 # ================================================================================
5 # Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved.
6 # Modifications Copyright (C) 2020 Bell Canada. All rights reserved.
7 # Modifications Copyright (C) 2022 Nordix Foundation.
8 # ================================================================================
9 # Licensed under the Apache License, Version 2.0 (the "License");
10 # you may not use this file except in compliance with the License.
11 # You may obtain a copy of the License at
13 # http://www.apache.org/licenses/LICENSE-2.0
15 # Unless required by applicable law or agreed to in writing, software
16 # distributed under the License is distributed on an "AS IS" BASIS,
17 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 # See the License for the specific language governing permissions and
19 # limitations under the License.
21 # SPDX-License-Identifier: Apache-2.0
22 # ============LICENSE_END=========================================================
26 # Docker file to build an image that runs the simulators
29 FROM onap/policy-jre-alpine:2.3.1
31 LABEL maintainer="Policy Team"
32 LABEL org.opencontainers.image.title="Policy Models Simulator"
33 LABEL org.opencontainers.image.description="Policy Models Simulator image based on Alpine"
34 LABEL org.opencontainers.image.url="https://github.com/onap/policy-models"
35 LABEL org.opencontainers.image.vendor="ONAP Policy Team"
36 LABEL org.opencontainers.image.licenses="Apache-2.0"
37 LABEL org.opencontainers.image.created="${git.build.time}"
38 LABEL org.opencontainers.image.version="${git.build.version}"
39 LABEL org.opencontainers.image.revision="${git.commit.id.abbrev}"
41 ARG POLICY_LOGS=/var/log/onap/policy/simulators
43 ENV POLICY_HOME /opt/app/policy
44 ENV POLICY_LOGS ${POLICY_LOGS}
46 # Create DMaaP simulator user and group
47 # Add simulator-specific directories and set ownership as the simulator user
48 RUN mkdir -p ${POLICY_HOME}/simulators \
49 && mkdir -p ${POLICY_HOME}/simulators/bin \
50 && mkdir -p ${POLICY_LOGS} \
54 COPY /maven/* /packages
55 RUN tar xvfz /packages/models-simulator.tar.gz --directory ${POLICY_HOME}/simulators \
56 && rm /packages/models-simulator.tar.gz
58 # Ensure everything has the correct permissions
59 # Copy scripts simulator user area
60 COPY simulators.sh ${POLICY_HOME}/simulators/bin
61 RUN find /opt/app -type d -perm 755 \
62 && find /opt/app -type f -perm 644 \
63 && chmod 755 ${POLICY_HOME}/simulators/bin/* \
64 && chown -R policy:policy $POLICY_HOME $POLICY_LOGS
68 ENV PATH ${POLICY_HOME}/simulators/bin:$PATH
69 ENTRYPOINT [ "simulators.sh" ]