From 69ba31d1ea0b20c19df0e462a5bbb4b67097146a Mon Sep 17 00:00:00 2001 From: MichaelMorris Date: Tue, 10 Mar 2020 12:37:48 +0000 Subject: Run pods as non-root user Summary of changes: sdc-cassandra-init Added user sdc (in base image base_sdc-cqlsh - https://gerrit.onap.org/r/103436) Run entrypoint as user sdc Moved relevant files from /root/ to /home/sdc/ sdc-backend-init Added user sdc (in base image base_sdc-python - https://gerrit.onap.org/r/103436) Run entrypoint as user sdc Moved relevant files from /root/ to /home/sdc/ sdc-backend Run entrypoint as user jetty Moved relevant files from /root/ to /var/lib/jetty/ Moved cadi & cert files from /opt/app/jetty to /var/lib/jetty/ Moved ready_probe from /var/lib/read-probe.sh to /var/lib/jetty/read-probe.sh sdc-frontend Run entrypoint as user jetty Moved relevant files from /root/ to /var/lib/jetty/ Moved ready_probe from /var/lib/read-probe.sh to /var/lib/jetty/read-probe.sh sdc-onboard-backend-docker Run entrypoint as user jetty Moved relevant files from /root/ to /var/lib/jetty/ Moved ready_probe from /var/lib/read-probe.sh to /var/lib/jetty/read-probe.sh sdc-onboard-db-init-docker Run entrypoint as user sdc Added user sdc (in base image base_sdc-cqlsh - https://gerrit.onap.org/r/103436) Moved relevant files from /root/ to /home/sdc/ Signed-off-by: MichaelMorris Issue-ID: SDC-2798 Change-Id: I85be320a4a5e1cc5aeebbb98c4484d5d6fd06dfc (cherry picked from commit a2abf6ea18d512d367277bacaf7476754dc0eff5) --- catalog-be/sdc-backend-init/Dockerfile | 12 ++++++------ catalog-be/sdc-backend-init/startup.sh | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'catalog-be/sdc-backend-init') diff --git a/catalog-be/sdc-backend-init/Dockerfile b/catalog-be/sdc-backend-init/Dockerfile index 8b1a2e60ea..cb26610859 100644 --- a/catalog-be/sdc-backend-init/Dockerfile +++ b/catalog-be/sdc-backend-init/Dockerfile @@ -1,11 +1,11 @@ -FROM onap/base_sdc-python:1.4.1 +FROM onap/base_sdc-python:1.6.0-SNAPSHOT-latest -COPY chef-solo /root/chef-solo/ +COPY --chown=sdc:sdc chef-solo /home/sdc/chef-solo/ -COPY chef-repo/cookbooks /root/chef-solo/cookbooks/ +COPY --chown=sdc:sdc chef-repo/cookbooks /home/sdc/chef-solo/cookbooks/ -COPY startup.sh /root/ +COPY --chown=sdc:sdc startup.sh /home/sdc/ -RUN chmod 770 /root/startup.sh +RUN chmod 770 /home/sdc/startup.sh -ENTRYPOINT [ "/root/startup.sh" ] +ENTRYPOINT [ "/home/sdc/startup.sh" ] diff --git a/catalog-be/sdc-backend-init/startup.sh b/catalog-be/sdc-backend-init/startup.sh index 0a96e49723..a379677bfb 100644 --- a/catalog-be/sdc-backend-init/startup.sh +++ b/catalog-be/sdc-backend-init/startup.sh @@ -1,6 +1,6 @@ #!/bin/sh -cd /root/chef-solo || exit $? +cd /home/sdc/chef-solo || exit $? chef-solo -c solo.rb -E "${ENVNAME}" rc=$? if [ $rc != 0 ]; then exit $rc; fi -- cgit 1.2.3-korg