1
Fork 0
mirror of https://github.com/Steffo99/sophon.git synced 2024-10-16 15:17:25 +00:00

Implement container HEALTHCHECK

This commit is contained in:
Steffo 2021-11-01 04:10:50 +01:00
parent be0d772b5f
commit 6f83979f29

View file

@ -1,27 +1,40 @@
# Modified jupyter/scipy-notebook for better integration with Sophon # Modified jupyter/scipy-notebook for better integration with Sophon
# Override the default "jovyan" user FROM jupyter/scipy-notebook AS base
ARG NB_USER="sophon" # Set the maintainer label
# Set the base image of the notebook
FROM jupyter/scipy-notebook
# Image labels
LABEL maintainer="Stefano Pigozzi <me@steffo.eu>" LABEL maintainer="Stefano Pigozzi <me@steffo.eu>"
# As the default user...
USER ${NB_UID}
WORKDIR "${HOME}"
# Install the JupyterLab Sophon theme
RUN jupyter labextension install "jupyterlab_theme_sophon"
# Enable the JupyterLab Sophon theme
RUN jupyter labextension enable "jupyter_theme_sophon"
# Set the JupyterLab Sophon theme as default
RUN mkdir -p '.jupyter/lab/user-settings/@jupyterlab/apputils-extension/'
RUN echo '{"theme": "JupyterLab Sophon"}' > ".jupyter/lab/user-settings/@jupyterlab/apputils-extension/themes.jupyterlab-settings"
FROM base AS env
# Override the default "jovyan" user
ARG NB_USER="sophon"
# Set useful envvars for Sophon notebooks # Set useful envvars for Sophon notebooks
ENV JUPYTER_ENABLE_LAB=yes ENV JUPYTER_ENABLE_LAB=yes
ENV RESTARTABLE=yes ENV RESTARTABLE=yes
ENV GRANT_SUDO=yes ENV GRANT_SUDO=yes
FROM env AS extensions
# As the default user...
USER ${NB_UID}
WORKDIR "${HOME}"
# Install the JupyterLab Sophon theme
RUN jupyter labextension install "jupyterlab_theme_sophon"
# Enable the JupyterLab Sophon theme
RUN jupyter labextension enable "jupyterlab_theme_sophon"
# Set the JupyterLab Sophon theme as default
RUN mkdir -p '.jupyter/lab/user-settings/@jupyterlab/apputils-extension/'
RUN echo '{"theme": "JupyterLab Sophon"}' > ".jupyter/lab/user-settings/@jupyterlab/apputils-extension/themes.jupyterlab-settings"
FROM extensions AS healthcheck
# As root...
USER root
# Install cURL
RUN apt-get update
RUN apt-get install -y curl
# Use curl to check the health status
HEALTHCHECK --start-period=5s --timeout=5s --interval=10s CMD ["curl", "--output", "/dev/null", "http://localhost:8888"]
# We probably should go back to the default user
USER ${NB_UID}