Skip to content

Commit

Permalink
Small improvements to startup hooks (#1976)
Browse files Browse the repository at this point in the history
* Small improvements to startup hooks

* Fix
  • Loading branch information
mathbunnyru committed Aug 20, 2023
1 parent e6f209e commit cf9a8b6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
6 changes: 6 additions & 0 deletions images/docker-stacks-foundation/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,12 @@ CMD ["start.sh"]
# Copy local files as late as possible to avoid cache busting
COPY start.sh /usr/local/bin/

USER root

# Create dirs for startup hooks
RUN mkdir /usr/local/bin/start-notebook.d && \
mkdir /usr/local/bin/before-notebook.d

# Switch back to jovyan to avoid accidental container runs as root
USER ${NB_UID}

Expand Down
10 changes: 5 additions & 5 deletions images/docker-stacks-foundation/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,25 @@ run-hooks () {
if [[ ! -d "${1}" ]] ; then
return
fi
_log "${0}: running hooks in ${1} as uid / gid: $(id -u) / $(id -g)"
_log "${0}: running hooks in: ${1} as uid: $(id -u) gid: $(id -g)"
for f in "${1}/"*; do
case "${f}" in
*.sh)
_log "${0}: running script ${f}"
_log "${0}: sourcing shell script: ${f}"
# shellcheck disable=SC1090
source "${f}"
;;
*)
if [[ -x "${f}" ]] ; then
_log "${0}: running executable ${f}"
_log "${0}: running executable: ${f}"
"${f}"
else
_log "${0}: ignoring non-executable ${f}"
_log "${0}: ignoring non-executable: ${f}"
fi
;;
esac
done
_log "${0}: done running hooks in ${1}"
_log "${0}: done running hooks in: ${1}"
}

# A helper function to unset env vars listed in the value of the env var
Expand Down
1 change: 0 additions & 1 deletion images/pyspark-notebook/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ RUN if [ -z "${scala_version}" ]; then \
ln -s "spark-${APACHE_SPARK_VERSION}-bin-hadoop${HADOOP_VERSION}-scala${scala_version}" "${SPARK_HOME}"; \
fi && \
# Add a link in the before_notebook hook in order to source automatically PYTHONPATH && \
mkdir -p /usr/local/bin/before-notebook.d && \
ln -s "${SPARK_HOME}/sbin/spark-config.sh" /usr/local/bin/before-notebook.d/spark-config.sh

# Configure IPython system-wide
Expand Down

0 comments on commit cf9a8b6

Please sign in to comment.