mmis | ef24b05 | 2018-07-10 10:50:05 +0100 | [diff] [blame] | 1 | # |
| 2 | # Docker file to build an image that runs APEX on Java 8 in Ubuntu |
| 3 | # |
| 4 | FROM ubuntu:16.04 |
| 5 | |
| 6 | RUN apt-get update && \ |
| 7 | apt-get upgrade -y && \ |
| 8 | apt-get install -y software-properties-common && \ |
| 9 | add-apt-repository ppa:openjdk-r/ppa -y && \ |
| 10 | apt-get update && \ |
| 11 | apt-get install -y openjdk-8-jdk |
| 12 | |
| 13 | # Create apex user and group |
| 14 | RUN groupadd apexuser |
| 15 | RUN useradd --create-home -g apexuser apexuser |
| 16 | |
| 17 | # Add Apex-specific directories and set ownership as the Apex admin user |
| 18 | RUN mkdir -p /opt/app/policy/apex-pdp |
| 19 | RUN mkdir -p /var/log/onap/policy/apex-pdp |
| 20 | RUN chown -R apexuser:apexuser /var/log/onap/policy/apex-pdp |
| 21 | |
| 22 | # Unpack the tarball |
| 23 | RUN mkdir /packages |
| 24 | COPY apex-pdp-package-full.tar.gz /packages |
| 25 | RUN tar xvfz /packages/apex-pdp-package-full.tar.gz --directory /opt/app/policy/apex-pdp |
| 26 | RUN rm /packages/apex-pdp-package-full.tar.gz |
| 27 | |
| 28 | # Ensure everything has the correct permissions |
| 29 | RUN find /opt/app -type d -perm 755 |
| 30 | RUN find /opt/app -type f -perm 644 |
| 31 | RUN chmod a+x /opt/app/policy/apex-pdp/bin/* |
| 32 | |
| 33 | # Copy examples to Apex user area |
| 34 | RUN cp -pr /opt/app/policy/apex-pdp/examples /home/apexuser |
mmis | eed7a08 | 2018-07-17 00:30:34 +0100 | [diff] [blame^] | 35 | |
mmis | ef24b05 | 2018-07-10 10:50:05 +0100 | [diff] [blame] | 36 | RUN apt-get clean |
| 37 | |
| 38 | RUN chown -R apexuser:apexuser /home/apexuser/* |
mmis | eed7a08 | 2018-07-17 00:30:34 +0100 | [diff] [blame^] | 39 | |
| 40 | USER apexuser |
| 41 | ENV PATH /opt/app/policy/apex-pdp/bin:$PATH |
mmis | ef24b05 | 2018-07-10 10:50:05 +0100 | [diff] [blame] | 42 | WORKDIR /home/apexuser |