Docker container for DMaaP Simulator
[policy/models.git] / models-sim / models-sim-dmaap / src / main / package / docker / Dockerfile
1 #
2 # ============LICENSE_START=======================================================
3 #  Copyright (C) 2019 Nordix Foundation.
4 # ================================================================================
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 #      http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16 #
17 # SPDX-License-Identifier: Apache-2.0
18 # ============LICENSE_END=========================================================
19 #
20
21 #
22 # Docker file to build an image that runs the DMaaP simulator on Java 8 in alpine
23 #
24
25 FROM onap/policy-common-alpine:1.4.0
26
27 LABEL maintainer="Policy Team"
28
29 ARG POLICY_LOGS=/var/log/onap/policy/dmaap-sim
30
31 ENV POLICY_HOME=/opt/app/policy
32 ENV POLICY_LOGS=${POLICY_LOGS}
33
34 RUN apk add --no-cache --update \
35     bash \
36     nss \
37     procps \
38     coreutils \
39     findutils \
40     grep \
41     zip \
42     unzip \
43     curl \
44     wget \
45     openssh \
46     iproute2 \
47     iputils \
48     vim \
49     openjdk8
50
51 # Create DMaaP simulator user and group
52 # Add simulator-specific directories and set ownership as the simulator user
53 RUN mkdir -p ${POLICY_HOME}/dmaap-sim \
54     && mkdir -p ${POLICY_HOME}/dmaap-sim/bin \
55     && mkdir -p ${POLICY_LOGS} \
56     && chown -R policy:policy ${POLICY_LOGS} \
57     && mkdir /packages
58
59 # Unpack the tarball
60 COPY policy-models-sim-dmaap-tarball.tar.gz /packages
61 RUN tar xvfz /packages/policy-models-sim-dmaap-tarball.tar.gz --directory ${POLICY_HOME}/dmaap-sim \
62     && rm /packages/policy-models-sim-dmaap-tarball.tar.gz
63
64 # Ensure everything has the correct permissions
65 # Copy examples to DMaaP simulator user area
66 COPY dmaap-sim.sh ${POLICY_HOME}/dmaap-sim/bin
67 RUN find /opt/app -type d -perm 755 \
68     && find /opt/app -type f -perm 644 \
69     && chmod a+x ${POLICY_HOME}/dmaap-sim/bin/*
70
71 USER policy
72 ENV PATH ${POLICY_HOME}/dmaap-sim/bin:$PATH
73 ENTRYPOINT [ "bash", "dmaap-sim.sh" ]