Skip to content

Commit cf9a8b6

Browse files
authored
Small improvements to startup hooks (#1976)
* Small improvements to startup hooks * Fix
1 parent e6f209e commit cf9a8b6

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

images/docker-stacks-foundation/Dockerfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,12 @@ CMD ["start.sh"]
129129
# Copy local files as late as possible to avoid cache busting
130130
COPY start.sh /usr/local/bin/
131131

132+
USER root
133+
134+
# Create dirs for startup hooks
135+
RUN mkdir /usr/local/bin/start-notebook.d && \
136+
mkdir /usr/local/bin/before-notebook.d
137+
132138
# Switch back to jovyan to avoid accidental container runs as root
133139
USER ${NB_UID}
134140

images/docker-stacks-foundation/start.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,25 +20,25 @@ run-hooks () {
2020
if [[ ! -d "${1}" ]] ; then
2121
return
2222
fi
23-
_log "${0}: running hooks in ${1} as uid / gid: $(id -u) / $(id -g)"
23+
_log "${0}: running hooks in: ${1} as uid: $(id -u) gid: $(id -g)"
2424
for f in "${1}/"*; do
2525
case "${f}" in
2626
*.sh)
27-
_log "${0}: running script ${f}"
27+
_log "${0}: sourcing shell script: ${f}"
2828
# shellcheck disable=SC1090
2929
source "${f}"
3030
;;
3131
*)
3232
if [[ -x "${f}" ]] ; then
33-
_log "${0}: running executable ${f}"
33+
_log "${0}: running executable: ${f}"
3434
"${f}"
3535
else
36-
_log "${0}: ignoring non-executable ${f}"
36+
_log "${0}: ignoring non-executable: ${f}"
3737
fi
3838
;;
3939
esac
4040
done
41-
_log "${0}: done running hooks in ${1}"
41+
_log "${0}: done running hooks in: ${1}"
4242
}
4343

4444
# A helper function to unset env vars listed in the value of the env var

images/pyspark-notebook/Dockerfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ RUN if [ -z "${scala_version}" ]; then \
5757
ln -s "spark-${APACHE_SPARK_VERSION}-bin-hadoop${HADOOP_VERSION}-scala${scala_version}" "${SPARK_HOME}"; \
5858
fi && \
5959
# Add a link in the before_notebook hook in order to source automatically PYTHONPATH && \
60-
mkdir -p /usr/local/bin/before-notebook.d && \
6160
ln -s "${SPARK_HOME}/sbin/spark-config.sh" /usr/local/bin/before-notebook.d/spark-config.sh
6261

6362
# Configure IPython system-wide

0 commit comments

Comments
 (0)