Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 23 additions & 3 deletions docker/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ if [ "$1" = 'start-tomcat.sh' ] || [ "$1" = 'catalina.sh' ]; then
export ERDDAP_flagKeyKey=$(cat /proc/sys/kernel/random/uuid)
fi

echo "Starting preinitialization"
PREINIT_START=$(date +%s%3N)

USER_ID=${TOMCAT_USER_ID:-1000}
GROUP_ID=${TOMCAT_GROUP_ID:-1000}

Expand All @@ -35,9 +38,23 @@ if [ "$1" = 'start-tomcat.sh' ] || [ "$1" = 'catalina.sh' ]; then
# Restrict permissions on conf
###

chown -R $USER_ID:$GROUP_ID ${CATALINA_HOME} && find ${CATALINA_HOME}/conf \
-type d -exec chmod 755 {} \; -o -type f -exec chmod 400 {} \;
chown -R $USER_ID:$GROUP_ID /erddapData
chown -R $USER_ID:$GROUP_ID \
${CATALINA_HOME}/bin \
${CATALINA_HOME}/conf \
${CATALINA_HOME}/content \
${CATALINA_HOME}/logs \
${CATALINA_HOME}/temp \
${CATALINA_HOME}/work
Comment thread
srstsavage marked this conversation as resolved.
find ${CATALINA_HOME}/webapps/erddap -type d -exec chown $USER_ID:$GROUP_ID {} +
find ${CATALINA_HOME}/webapps/erddap -type f -name '*.sh' -exec chown $USER_ID:$GROUP_ID {} +
find ${CATALINA_HOME}/conf -type d -exec chmod 755 {} +
find ${CATALINA_HOME}/conf -type f -exec chmod 400 {} +
Comment thread
srstsavage marked this conversation as resolved.

if [ "${SKIP_ERDDAP_DATA_CHOWN:-0}" = "1" ]; then
echo "Skipping /erddapData chown due to SKIP_ERDDAP_DATA_CHOWN setting"
else
chown -R $USER_ID:$GROUP_ID /erddapData
fi
Comment thread
srstsavage marked this conversation as resolved.
sync

###
Expand All @@ -58,6 +75,9 @@ if [ "$1" = 'start-tomcat.sh' ] || [ "$1" = 'catalina.sh' ]; then
done
fi

PREINIT_END=$(date +%s%3N)
echo "Preinitialization finished in $(( $PREINIT_END - $PREINIT_START ))ms"

exec setpriv --reuid $USER_ID --regid $GROUP_ID --init-groups "$@"
fi

Expand Down
Loading