Run as non root 78/78578/1
authorsebdet <sebastien.determe@intl.att.com>
Fri, 15 Feb 2019 17:33:19 +0000 (18:33 +0100)
committersebdet <sebastien.determe@intl.att.com>
Fri, 15 Feb 2019 17:33:19 +0000 (18:33 +0100)
Modify the CLAMP docker image so that it does not run as root but as
clamp user

Issue-ID: CLAMP-298
Change-Id: I0bf7bed9cb76a2fcde72f2e23b66e03f03e5fe0e
Signed-off-by: sebdet <sebastien.determe@intl.att.com>
src/main/docker/Dockerfile
src/main/resources/boot-message.txt

index 44e2809..983dea7 100644 (file)
@@ -15,10 +15,19 @@ RUN test -n "$http_proxy" && echo "Acquire::Proxy \"http://$http_proxy\";" > /et
     apt-get -y dist-upgrade &&  \\r
     apt-get install -y openjdk-8-jre-headless\r
 \r
+RUN groupadd -r onap && useradd --no-log-init -r -g onap clamp\r
+VOLUME /opt/clamp/config\r
+RUN mkdir /var/log/onap\r
+RUN chmod a+rwx /var/log/onap\r
+\r
 COPY onap-clamp/clamp.jar /opt/clamp/app.jar\r
-VOLUME /etc\r
+RUN chmod 700 /opt/clamp/app.jar\r
+\r
 COPY onap-clamp/startService.sh /opt/clamp/startService.sh\r
 RUN chmod 700 /opt/clamp/startService.sh\r
 \r
+RUN chown -R clamp:onap /opt/clamp\r
+\r
+USER clamp\r
 WORKDIR /opt/clamp/\r
 ENTRYPOINT ./startService.sh \r
index eea540b..92e4ab0 100644 (file)
@@ -1,10 +1,14 @@
      
          
-╔═╗╔╗╔╔═╗╔═╗  ╔═╗┌─┐┌─┐┌─┐┌┐ ┬  ┌─┐┌┐┌┌─┐┌─┐
-║ ║║║║╠═╣╠═╝  ║  ├─┤└─┐├─┤├┴┐│  ├─┤││││  ├─┤
-╚═╝╝╚╝╩ ╩╩    ╚═╝┴ ┴└─┘┴ ┴└─┘┴─┘┴ ┴┘└┘└─┘┴ ┴
-        ╔═╗╦  ╔═╗╔╦╗╔═╗                     
-        ║  ║  ╠═╣║║║╠═╝                     
-        ╚═╝╩═╝╩ ╩╩ ╩╩                       
+ _____  _  _    __    ____    ____  __  __  ____  __    ____  _  _ 
+(  _  )( \( )  /__\  (  _ \  (  _ \(  )(  )(  _ \(  )  (_  _)( \( )
+ )(_)(  )  (  /(__)\  )___/   )(_) ))(__)(  ) _ < )(__  _)(_  )  ( 
+(_____)(_)\_)(__)(__)(__)    (____/(______)(____/(____)(____)(_)\_)
+                 ___  __      __    __  __  ____                                  
+                / __)(  )    /__\  (  \/  )(  _ \                                 
+               ( (__  )(__  /(__)\  )    (  )___/                                 
+                \___)(____)(__)(__)(_/\/\_)(__)                                   
+
+
 
    :: Starting ::     
\ No newline at end of file