51e7eaa6f6b8257e10b8fdc04d429f0b2a3e2468
[policy/models.git] / models-sim / policy-models-sim-pdp / src / main / package / docker / Dockerfile
1 #
2 # ============LICENSE_START=======================================================
3 #  Copyright (C) 2019 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-common-alpine:1.4.0
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 RUN apk add --no-cache --update \
36     bash \
37     nss \
38     procps \
39     coreutils \
40     findutils \
41     grep \
42     zip \
43     unzip \
44     curl \
45     wget \
46     openssh \
47     iproute2 \
48     iputils \
49     vim \
50     openjdk8
51
52 # Create PDP simulator user and group
53 # Add simulator-specific directories and set ownership as the simulator user
54 RUN mkdir -p ${POLICY_HOME}/pdp-sim \
55     && mkdir -p ${POLICY_HOME}/pdp-sim/bin \
56     && mkdir -p ${POLICY_LOGS} \
57     && chown -R policy:policy ${POLICY_LOGS} \
58     && mkdir /packages
59
60 # Unpack the tarball
61 COPY policy-models-sim-pdp-tarball.tar.gz /packages
62 RUN tar xvfz /packages/policy-models-sim-pdp-tarball.tar.gz --directory ${POLICY_HOME}/pdp-sim \
63     && rm /packages/policy-models-sim-pdp-tarball.tar.gz
64
65 # Ensure everything has the correct permissions
66 # Copy examples to PDP simulator user area
67 COPY pdp-sim.sh ${POLICY_HOME}/pdp-sim/bin
68 RUN find /opt/app -type d -perm 755 \
69     && find /opt/app -type f -perm 644 \
70     && chmod 755 ${POLICY_HOME}/pdp-sim/bin/*
71
72 USER policy
73 ENV PATH ${POLICY_HOME}/pdp-sim/bin:$PATH
74 ENTRYPOINT [ "bash", "pdp-sim.sh" ]