3bf4669476fc49cdfb4f7defb7348f9a542bdad3
[policy/models.git] / models-sim / packages / models-simulator-docker / src / main / docker / Dockerfile
1 #
2 # ============LICENSE_START=======================================================
3 # ONAP
4 # ================================================================================
5 # Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved.
6 # Modifications Copyright (C) 2020 Bell Canada. All rights reserved.
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
24 #
25 # Docker file to build an image that runs the simulators
26 #
27
28 FROM onap/policy-jre-alpine:2.3.1
29
30 LABEL maintainer="Policy Team"
31
32 ARG POLICY_LOGS=/var/log/onap/policy/simulators
33
34 ENV POLICY_HOME /opt/app/policy
35 ENV POLICY_LOGS ${POLICY_LOGS}
36
37 # Create DMaaP simulator user and group
38 # Add simulator-specific directories and set ownership as the simulator user
39 RUN mkdir -p ${POLICY_HOME}/simulators \
40     && mkdir -p ${POLICY_HOME}/simulators/bin \
41     && mkdir -p ${POLICY_LOGS} \
42     && mkdir /packages
43
44 # Unpack the tarball
45 COPY /maven/* /packages
46 RUN tar xvfz /packages/models-simulator.tar.gz --directory ${POLICY_HOME}/simulators \
47     && rm /packages/models-simulator.tar.gz
48
49 # Ensure everything has the correct permissions
50 # Copy scripts simulator user area
51 COPY simulators.sh ${POLICY_HOME}/simulators/bin
52 RUN find /opt/app -type d -perm 755 \
53     && find /opt/app -type f -perm 644 \
54     && chmod 755 ${POLICY_HOME}/simulators/bin/* \
55     && chown -R policy:policy $POLICY_HOME $POLICY_LOGS
56
57 USER policy:policy
58
59 ENV PATH ${POLICY_HOME}/simulators/bin:$PATH
60 ENTRYPOINT [ "simulators.sh" ]