Update snapshot and/or references of policy/models to latest snapshots
[policy/models.git] / models-sim / policy-models-sim-pdp / src / main / package / docker / Dockerfile
1 #
2 # ============LICENSE_START=======================================================
3 #  Copyright (C) 2019-2021,2023 Nordix Foundation.
4 #  Modifications Copyright (C) 2019 AT&T Intellectual Property.
5 # ================================================================================
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
9 #
10 #      http://www.apache.org/licenses/LICENSE-2.0
11 #
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
17 #
18 # SPDX-License-Identifier: Apache-2.0
19 # ============LICENSE_END=========================================================
20 #
21
22 #
23 # Docker file to build an image that runs the PDP simulator on Java 8 in alpine
24 #
25
26 FROM onap/policy-jre-alpine:3.1.3-SNAPSHOT
27
28 LABEL maintainer="Policy Team"
29
30 ARG POLICY_LOGS=/var/log/onap/policy/pdp-sim
31
32 ENV POLICY_HOME=/opt/app/policy
33 ENV POLICY_LOGS=${POLICY_LOGS}
34
35 # Create PDP simulator user and group
36 # Add simulator-specific directories and set ownership as the simulator user
37 USER root
38 RUN mkdir -p ${POLICY_HOME}/pdp-sim \
39     && mkdir -p ${POLICY_HOME}/pdp-sim/bin \
40     && mkdir -p ${POLICY_LOGS} \
41     && chown -R policy:policy ${POLICY_LOGS} \
42     && mkdir /packages
43
44 # Unpack the tarball
45 COPY policy-models-sim-pdp-tarball.tar.gz /packages
46 RUN tar xvfz /packages/policy-models-sim-pdp-tarball.tar.gz --directory ${POLICY_HOME}/pdp-sim \
47     && rm /packages/policy-models-sim-pdp-tarball.tar.gz
48
49 # Ensure everything has the correct permissions
50 # Copy examples to PDP simulator user area
51 COPY pdp-sim.sh ${POLICY_HOME}/pdp-sim/bin
52 RUN find /opt/app -type d -perm 755 \
53     && find /opt/app -type f -perm 644 \
54     && chmod 755 ${POLICY_HOME}/pdp-sim/bin/*
55
56 USER policy
57 ENV PATH ${POLICY_HOME}/pdp-sim/bin:$PATH
58 ENTRYPOINT [ "sh", "/opt/app/policy/pdp-sim/bin/pdp-sim.sh" ]