blob: b5c6bc94049cfab3656f40a24d75f846f59092e6 [file] [log] [blame]
liamfallon755eb9d2020-01-22 12:11:11 +00001#-------------------------------------------------------------------------------
2# ============LICENSE_START=======================================================
3# Copyright (C) 2020 Nordix Foundation.
Jim Hahn6669d2b2021-08-25 11:44:58 -04004# Modification Copyright (C) 2020-2021 AT&T Foundation.
a.sreekumar1f477532021-02-23 15:45:34 +00005# Modifications Copyright (C) 2021 Bell Canada.
liamfallon755eb9d2020-01-22 12:11:11 +00006# ================================================================================
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
mmisef24b052018-07-10 10:50:05 +010010#
liamfallon755eb9d2020-01-22 12:11:11 +000011# http://www.apache.org/licenses/LICENSE-2.0
mmisef24b052018-07-10 10:50:05 +010012#
liamfallon755eb9d2020-01-22 12:11:11 +000013# 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#
liamfallon0ec3b502021-11-25 15:50:38 +000026FROM onap/policy-jdk-alpine:2.4.0
mmisef24b052018-07-10 10:50:05 +010027
Dmitry Puzikov1aac8642019-03-25 10:47:23 +010028LABEL maintainer="Policy Team"
29
Dmitry Puzikov1aac8642019-03-25 10:47:23 +010030ARG POLICY_LOGS=/var/log/onap/policy/apex-pdp
shaoqiuae257d12019-06-03 07:08:41 +000031ENV POLICY_HOME=/opt/app/policy/apex-pdp
Rashmi Pujar7b945412019-06-17 10:34:49 -040032ENV POLICY_LOGS=$POLICY_LOGS
Dmitry Puzikov1aac8642019-03-25 10:47:23 +010033
Jim Hahn6669d2b2021-08-25 11:44:58 -040034RUN apk update \
35 && apk add --no-cache \
liamfallon755eb9d2020-01-22 12:11:11 +000036 vim \
liamfallon755eb9d2020-01-22 12:11:11 +000037 iputils \
38 && addgroup -S apexuser && adduser -S apexuser -G apexuser \
39 && mkdir -p $POLICY_HOME \
Rashmi Pujar7b945412019-06-17 10:34:49 -040040 && mkdir -p $POLICY_LOGS \
liamfallon755eb9d2020-01-22 12:11:11 +000041 && chown -R apexuser:apexuser $POLICY_LOGS \
42 && mkdir /packages
mmisef24b052018-07-10 10:50:05 +010043
Rashmi Pujar7b945412019-06-17 10:34:49 -040044COPY /maven/apex-pdp-package-full.tar.gz /packages
45RUN tar xvfz /packages/apex-pdp-package-full.tar.gz --directory $POLICY_HOME \
liamfallon755eb9d2020-01-22 12:11:11 +000046 && rm /packages/apex-pdp-package-full.tar.gz \
47 && find /opt/app -type d -perm 755 \
Dmitry Puzikov1aac8642019-03-25 10:47:23 +010048 && find /opt/app -type f -perm 644 \
liamfallon755eb9d2020-01-22 12:11:11 +000049 && chmod 755 $POLICY_HOME/bin/* \
50 && cp -pr $POLICY_HOME/examples /home/apexuser \
a.sreekumar6fae58f2020-01-06 15:48:31 +000051 && chown -R apexuser:apexuser /home/apexuser/* $POLICY_HOME \
52 && chmod 755 $POLICY_HOME/etc/*
mmiseed7a082018-07-17 00:30:34 +010053
54USER apexuser
Rashmi Pujar7b945412019-06-17 10:34:49 -040055ENV PATH $POLICY_HOME/bin:$PATH
mmisef24b052018-07-10 10:50:05 +010056WORKDIR /home/apexuser
Ram Krishna Verma4d967d62021-03-23 13:03:52 -040057ENTRYPOINT [ "/bin/sh" ]