Cleaned up jupyter container, fixed PATH

This commit is contained in:
2023-03-07 09:03:10 -08:00
parent 41ee2dc5b7
commit d4666c5a0d
6 changed files with 48 additions and 116 deletions

View File

@ -75,14 +75,15 @@ ENV CONDA_DIR=/opt/conda \
ENV PATH="${CONDA_DIR}/bin:${PATH}" \
HOME="/home/${NB_USER}"
# Copy a script that we will use to correct permissions after running certain commands
# A script that we will use to correct permissions after running certain commands
COPY fix-permissions.sh /usr/local/bin/fix-permissions
RUN chmod a+rx /usr/local/bin/fix-permissions
# Enable prompt color in the skeleton .bashrc before creating the default NB_USER
RUN sed -i 's/^#force_color_prompt=yes/force_color_prompt=yes/' /etc/skel/.bashrc && \
# Add call to conda init script see https://stackoverflow.com/a/58081608/4413446
echo 'eval "$(command conda shell.bash hook 2> /dev/null)"' >> /etc/skel/.bashrc
echo 'eval "$(command conda shell.bash hook 2> /dev/null)"' >> /etc/skel/.bashrc && \
echo "export PATH=${CONDA_DIR}/bin:\$PATH" >> /etc/skel/.bashrc
# Create user
RUN echo "auth requisite pam_deny.so" >> /etc/pam.d/su && \
@ -103,7 +104,6 @@ RUN echo "auth requisite pam_deny.so" >> /etc/pam.d/su && \
USER ${NB_UID}
# Pin python version here, or set it to "default"
ARG PYTHON_VERSION=3.10
@ -184,14 +184,6 @@ RUN mkdir -p "${HOME}/.jupyter" && \
chmod u+rwx "${HOME}/.jupyter"
VOLUME "${HOME}/.jupyter"
# Legacy for Jupyter Notebook Server, see: [#1205](https://github.com/jupyter/docker-stacks/issues/1205)
#RUN sed -re "s/c.ServerApp/c.NotebookApp/g" \
# /etc/jupyter/jupyter_server_config.py > /etc/jupyter/jupyter_notebook_config.py && \
# fix-permissions /etc/jupyter/
# HEALTHCHECK documentation: https://docs.docker.com/engine/reference/builder/#healthcheck
# This healtcheck works well for `lab`, `notebook`, `nbclassic`, `server` and `retro` jupyter commands
# https://github.com/jupyter/docker-stacks/issues/915#issuecomment-1068528799
HEALTHCHECK --interval=15s --timeout=3s --start-period=5s --retries=3 \
CMD wget -O- --no-verbose --tries=1 --no-check-certificate \
http${GEN_CERT:+s}://localhost:8888${JUPYTERHUB_SERVICE_PREFIX:-/}api || exit 1