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