From c181fe807cf6841272dcbf82ef10024bca1463cc Mon Sep 17 00:00:00 2001 From: florez_j Date: Thu, 30 Oct 2025 18:23:27 +0100 Subject: [PATCH] Update to container and compose service to create a landing page for the jupyterlab interface --- Dockerfile | 12 ++++++++++-- docker-compose.yaml | 35 ++++++++++++++++++++++++----------- 2 files changed, 34 insertions(+), 13 deletions(-) diff --git a/Dockerfile b/Dockerfile index e4cf003..1e975d3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,11 +10,20 @@ ENV ENV_NAME=idear_env WORKDIR /idear #RUN apt-get update && apt-get install -y cifs-utils +# Install Graphviz system binaries +RUN apt-get update && apt-get install -y \ + graphviz \ + && rm -rf /var/lib/apt/lists/* + +# Add this after WORKDIR /idear and before the conda install +RUN conda config --remove channels defaults && \ + conda config --add channels conda-forge && \ + conda config --set channel_priority strict # Use mamba if available for faster installation RUN conda install -y -n base -c conda-forge mamba && \ mamba create -y -n $ENV_NAME -c conda-forge python=3.11 \ - jupyter numpy h5py pandas matplotlib plotly=5.24 scipy pip && \ + jupyter jupyterlab numpy h5py pandas matplotlib plotly=5.24 scipy pip && \ conda clean --all -y && rm -rf /root/.cache/pip # Activate the environment and install additional pip packages @@ -40,7 +49,6 @@ RUN conda run -n $ENV_NAME pip install -r /idear/requirements.txt # Add JupyterLab RUN pip install graphviz -RUN pip install --no-cache-dir jupyterlab # If you want to set JupyterLab as the default command #CMD ["jupyter", "lab", "--ip=0.0.0.0", "--port=8888", "--no-browser", "--allow-root", "--NotebookApp.token='my-token'"] diff --git a/docker-compose.yaml b/docker-compose.yaml index 9c7a022..2ea81e0 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,19 +1,17 @@ -version: '3.9' - services: idear_processor_networked: image: idear_processor restart: unless-stopped environment: - DOCKER_CONTAINER=1 - - NETWORK_MOUNT=/mnt/network_mount ports: - "${JUPYTER_PORT:-8889}:8888" volumes: - - ./data:/idear/data - - ./figures:/idear/figures - - ./notebooks:/idear/notebooks - - ./scripts:/idear/scripts + - ./:/idear + #- ./data:/idear/data + #- ./figures:/idear/figures + #- ./notebooks:/idear/notebooks + #- ./scripts:/idear/scripts - network_mount:/mnt/network_mount:rw command: > bash -c " @@ -27,15 +25,30 @@ services: restart: unless-stopped environment: - DOCKER_CONTAINER=1 - - NETWORK_MOUNT=/idear/data + - JUPYTER_TOKEN=my-token ports: - "${JUPYTER_PORT:-8889}:8888" volumes: - ./:/idear command: > - bash -c " - jupyter lab --ip=0.0.0.0 --port=8888 --no-browser --allow-root --NotebookApp.token='${JUPYTER_TOKEN:-my-token}' - " + bash -c ' + if [ -f WELCOME.ipynb ]; then + DEFAULT_URL="/lab/workspaces/default?tree=WELCOME.ipynb" + echo "✅ WELCOME.ipynb found - setting as landing page" + jupyter trust WELCOME.ipynb + else + DEFAULT_URL="" + echo "⚠️ WELCOME.ipynb not found - using default homepage" + fi && + jupyter lab --ip=0.0.0.0 --port=8888 --no-browser --allow-root \ + --NotebookApp.token="${JUPYTER_TOKEN:-my-token}" --LabApp.default_url="$DEFAULT_URL" \ + --ExtensionApp.default_url="$DEFAULT_URL" + ' + + #command: > + # bash -c " + # jupyter lab --ip=0.0.0.0 --port=8888 --no-browser --allow-root --NotebookApp.token='${JUPYTER_TOKEN:-my-token}' + # " profiles: - local-only