Skip to content

Commit

Permalink
optimize container
Browse files Browse the repository at this point in the history
  • Loading branch information
mchyzer committed Aug 12, 2022
1 parent 6fd2ff9 commit 41de63e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
6 changes: 4 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,10 @@ RUN touch /opt/grouper/grouperEnv.sh \
&& mkdir -p /opt/tomee/work/Catalina/localhost/ \
&& mkdir -p /opt/grouper/certs/client \
&& mkdir -p /opt/grouper/certs/anchors \
&& chown -R tomcat:root /opt/grouper/ /etc/httpd/conf/ /home/tomcat/ /opt/tomee/ /usr/local/bin /etc/httpd/conf.d/ /opt/tier-support/ /usr/lib/jvm/java/jre/lib/security/cacerts \
&& chmod -R g+rwx /opt/grouper/ /etc/httpd/conf/ /home/tomcat/ /opt/tomee/ /usr/local/bin /etc/httpd/conf.d/ /opt/tier-support/ /usr/lib/jvm/java/jre/lib/security/cacerts
&& chown tomcat:root /opt/grouper/ /etc/httpd/conf/ /home/tomcat/ /opt/tomee/ /usr/local/bin /etc/httpd/conf.d/ /opt/tier-support/ /usr/lib/jvm/java/jre/lib/security/cacerts \
&& chown -R tomcat:root $(find /opt/grouper/ /etc/httpd/conf/ /home/tomcat/ /opt/tomee/ /usr/local/bin /etc/httpd/conf.d/ /opt/tier-support/ ! -user tomcat -o ! -group root -print) \
&& chmod g+rwx /opt/grouper/ /etc/httpd/conf/ /home/tomcat/ /opt/tomee/ /usr/local/bin /etc/httpd/conf.d/ /opt/tier-support/ /usr/lib/jvm/java/jre/lib/security/cacerts \
&& chmod -R g+rwx $(find /opt/grouper/ /etc/httpd/conf/ /home/tomcat/ /opt/tomee/ /usr/local/bin /etc/httpd/conf.d/ /opt/tier-support/ ! -perm -g+rwx )

# keep backup of files
RUN mkdir -p /opt/tier-support/originalFiles ; \
Expand Down
8 changes: 6 additions & 2 deletions container_files/usr-local-bin/librarySetupFiles.sh
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,13 @@ setupFiles_chownDirs() {
# do this last
if [ "$GROUPER_CHOWN_DIRS" = "true" ]
then
chown -R tomcat:tomcat /opt/grouper/grouperWebapp /opt/tomee
chown tomcat:root /opt/grouper /opt/tomee
returnCode=$?
echo "grouperContainer; INFO: (librarySetupFiles.sh-setupFiles_chownDirs) chown -R tomcat:tomcat /opt/grouper/grouperWebapp /opt/tomee, result: $returnCode"
echo "grouperContainer; INFO: (librarySetupFiles.sh-setupFiles_chownDirs) chown tomcat:root /opt/grouper /opt/tomee, result: $returnCode"

chown -R tomcat:root $(find /opt/grouper /opt/tomee ! -user tomcat -o ! -group root -print)
returnCode=$?
echo "grouperContainer; INFO: (librarySetupFiles.sh-setupFiles_chownDirs) chown -R tomcat:root \$(find /opt/grouper /opt/tomee ! -user tomcat -o ! -group root -print), result: $returnCode"
# dont fail on chown
#if [ $returnCode != 0 ]; then exit $returnCode; fi
fi
Expand Down

0 comments on commit 41de63e

Please sign in to comment.