8fe6f7c25118eb28d63251294907b2fddd3985f9
[policy/apex-pdp.git] / packages / apex-pdp-docker / src / main / docker / Dockerfile
1 #-------------------------------------------------------------------------------
2 # ============LICENSE_START=======================================================
3 #  Copyright (C) 2020 Nordix Foundation.
4 #  Modification Copyright (C) 2020-2021 AT&T Foundation.
5 #  Modifications Copyright (C) 2021 Bell Canada.
6 # ================================================================================
7 # Licensed under the Apache License, Version 2.0 (the "License");
8 # you may not use this file except in compliance with the License.
9 # You may obtain a copy of the License at
10 #
11 #      http://www.apache.org/licenses/LICENSE-2.0
12 #
13 # Unless required by applicable law or agreed to in writing, software
14 # distributed under the License is distributed on an "AS IS" BASIS,
15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # See the License for the specific language governing permissions and
17 # limitations under the License.
18 #
19 # SPDX-License-Identifier: Apache-2.0
20 # ============LICENSE_END=========================================================
21 #-------------------------------------------------------------------------------
22
23 #
24 # Docker file to build an image that runs APEX on Java 11 or better in alpine
25 #
26 FROM onap/policy-jdk-alpine:2.4.2
27
28 LABEL maintainer="Policy Team"
29
30 ARG POLICY_LOGS=/var/log/onap/policy/apex-pdp
31 ENV POLICY_HOME=/opt/app/policy/apex-pdp
32 ENV POLICY_LOGS=$POLICY_LOGS
33
34 RUN apk update \
35     && apk add --no-cache \
36         vim \
37         iputils \
38     && addgroup -S apexuser && adduser -S apexuser -G apexuser \
39     && mkdir -p $POLICY_HOME \
40     && mkdir -p $POLICY_LOGS \
41     && chown -R apexuser:apexuser $POLICY_LOGS \
42     && mkdir /packages
43
44 COPY /maven/apex-pdp-package-full.tar.gz /packages
45 RUN tar xvfz /packages/apex-pdp-package-full.tar.gz --directory $POLICY_HOME \
46     && rm /packages/apex-pdp-package-full.tar.gz \
47     && find /opt/app -type d -perm 755 \
48     && find /opt/app -type f -perm 644 \
49     && chmod 755 $POLICY_HOME/bin/* \
50     && cp -pr $POLICY_HOME/examples /home/apexuser \
51     && chown -R apexuser:apexuser /home/apexuser/* $POLICY_HOME \
52     && chmod 755 $POLICY_HOME/etc/*
53
54 USER apexuser
55 ENV PATH $POLICY_HOME/bin:$PATH
56 WORKDIR /home/apexuser
57 ENTRYPOINT [ "/bin/sh" ]