aboutsummaryrefslogtreecommitdiffstats
path: root/packages/apex-pdp-docker/src/main/docker/Dockerfile
blob: 48018878d911a450e7d39a18261123dc16a73d3b (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
#
# Docker file to build an image that runs APEX on Java 8 in alpine
#
FROM onap/policy-base-alpine:1.4.0

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/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_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_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_HOME}/bin/*

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

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