diff options
author | wr148d <wr148d@att.com> | 2020-06-02 13:13:46 -0400 |
---|---|---|
committer | wr148d <wr148d@att.com> | 2020-06-02 13:17:18 -0400 |
commit | bf48a65dc08a53a0057db879757e5e91e73492bc (patch) | |
tree | 65af0a101afe0f62381c98c202e1a05d723671e9 /sparkybe-onap-application/src/main/docker/Dockerfile | |
parent | 425e40c0e8319d55724283085dbb2ccee157f5ee (diff) |
Containers should not run as root by default
Issue-ID: AAI-2822
Signed-off-by: wr148d <wr148d@att.com>
Change-Id: I2927b16d08bf7fc0f6e85dcbfe5fbc119f864a23
Diffstat (limited to 'sparkybe-onap-application/src/main/docker/Dockerfile')
-rw-r--r-- | sparkybe-onap-application/src/main/docker/Dockerfile | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/sparkybe-onap-application/src/main/docker/Dockerfile b/sparkybe-onap-application/src/main/docker/Dockerfile index 117c54c..035abd2 100644 --- a/sparkybe-onap-application/src/main/docker/Dockerfile +++ b/sparkybe-onap-application/src/main/docker/Dockerfile @@ -2,9 +2,10 @@ FROM @aai.docker.namespace@/aai-common-@aai.base.image@:@aai.base.image.version@ ARG MICRO_HOME=/opt/app/sparky ARG BIN_HOME=$MICRO_HOME/bin +ARG UI_LOGS=/var/log/onap/AAI-UI # Build up the deployment folder structure -RUN mkdir -p $MICRO_HOME +RUN mkdir -p $MICRO_HOME $MICRO_HOME/logs $UI_LOGS # Changes related to:AAI-2180 # Additional optional steps for Ubuntu @@ -22,20 +23,18 @@ RUN if ((uname -v | grep -i "ubuntu") || ( cat /etc/*release|grep -i "ubuntu") JAVA_HOME=usr/lib/jvm/java-8-openjdk-amd64; \ export JAVA_HOME ; \ fi; \ - ########################################## - #Install gosu if not present - ########################################## - if type gosu 2>/dev/null; then \ - echo "skipping gosu installation"; \ - else \ - set -x ; \ - add-apt-repository -y ppa:tianon/gosu; \ - sudo apt-get update; \ - sudo apt-get install gosu; \ - fi;\ fi + +RUN groupadd aaiadmin -g 1000 +RUN adduser -u 1000 -h /opt/aaihome/aaiadmin -S -D -G aaiadmin -s /bin/bash aaiadmin + WORKDIR $MICRO_HOME -COPY /maven/sparkybe-onap-application/ . +RUN chown -R aaiadmin:aaiadmin $MICRO_HOME $MICRO_HOME/logs $UI_LOGS + +COPY --chown=aaiadmin:aaiadmin /maven/sparkybe-onap-application/ . + +USER aaiadmin + RUN chmod 755 $BIN_HOME/* \ && ln -snf /logs $MICRO_HOME/logs |