aboutsummaryrefslogtreecommitdiffstats
path: root/packages/apex-pdp-docker/src/main/docker/Dockerfile
blob: bd9052cce614d54a17a17f7391cbd140ce5234de (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#
# Docker file to build an image that runs APEX on Java 8 in alpine
#
FROM onap/policy-base-alpine

LABEL maintainer="Policy Team"

ARG BUILD_VERSION=${BUILD_VERSION}
ARG POLICY_LOGS=/var/log/onap/policy/apex-pdp

ENV BUILD_VERSION ${BUILD_VERSION}
ENV POLICY_HOME=/opt/app/policy
ENV POLICY_APEX_PDP_HOME=${POLICY_HOME}/apex-pdp
ENV POLICY_LOGS=${POLICY_LOGS}

RUN apk add --no-cache \
    vim \
    iproute2 \
    iputils

# Create apex user and group
RUN addgroup -S apexuser && adduser -S apexuser -G apexuser


# Add Apex-specific directories and set ownership as the Apex admin user
RUN mkdir -p ${POLICY_APEX_PDP_HOME} \
    && mkdir -p ${POLICY_LOGS} \
    && chown -R apexuser:apexuser ${POLICY_LOGS}

# Unpack the tarball
RUN mkdir /packages
COPY apex-pdp-package-full.tar.gz /packages
RUN tar xvfz /packages/apex-pdp-package-full.tar.gz --directory ${POLICY_APEX_PDP_HOME} \
    && rm /packages/apex-pdp-package-full.tar.gz

# Ensure everything has the correct permissions
RUN find /opt/app -type d -perm 755 \
    && find /opt/app -type f -perm 644 \
    && chmod a+x ${POLICY_APEX_PDP_HOME}/bin/*

# Copy examples to Apex user area
RUN cp -pr ${POLICY_APEX_PDP_HOME}/examples /home/apexuser \
    && chown -R apexuser:apexuser /home/apexuser/*

USER apexuser
ENV PATH ${POLICY_APEX_PDP_HOME}/bin:$PATH
WORKDIR /home/apexuser