From a5eae70447fbea74b0cfc185f373dc3e5ef2f681 Mon Sep 17 00:00:00 2001
From: YECHE Quentin <quentin.yeche@inrae.fr>
Date: Wed, 27 Sep 2023 14:33:22 +0200
Subject: [PATCH] added user fixed capturing output from conda run

---
 Dockerfile_jupyterlab | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/Dockerfile_jupyterlab b/Dockerfile_jupyterlab
index df0fa05..49cf89d 100644
--- a/Dockerfile_jupyterlab
+++ b/Dockerfile_jupyterlab
@@ -8,22 +8,29 @@ ARG env_name=rs-notebooks
 ADD *.ipynb /notebooks/
 ADD sample.geojson /notebooks/
 
+#adding user
+RUN useradd -m beyond &&\
+    chown -R beyond:beyond /notebooks
+
 # creating environment
 ADD environment_jupyterlab.yml ${dest_yml}
 RUN mamba env create --file ${dest_yml} --name ${env_name}
 
-# setting up shell to run in the correct environment
-SHELL ["conda", "run", "-n", "rs-notebooks", "/bin/bash", "-c"]
+# setting up shell to use conda run
+# this ensures that the CMD command is run in the correct environment
+SHELL ["conda", "run", "--no-capture-output","-n", "rs-notebooks", "/bin/bash", "-c"]
 
 # setting up jupyter lab to use bash as a terminal
 # this ensures that the right environment is activated in the terminal
 # should allow users to run pip installs from notebooks/jupyter lab terminal
 # without encountering issues with different environments
-#RUN /opt/conda/envs/rs-notebooks/bin/jupyter lab --generate-config && \
-RUN jupyter lab --generate-config
-RUN echo 'c.NotebookApp.terminado_settings = { "shell_command": ["/bin/bash"] }' >> /root/.jupyter/jupyter_lab_config.py
+RUN jupyter lab --generate-config &&\
+    echo 'c.NotebookApp.terminado_settings = { "shell_command": ["/bin/bash"] }' >> /root/.jupyter/jupyter_lab_config.py
 
 # setting up default landing folder
 WORKDIR /notebooks
 
-CMD jupyter lab --ip 0.0.0.0 --no-browser --allow-root
+# choosing new user as default
+USER beyond
+
+#CMD jupyter lab --ip 0.0.0.0 --no-browser --allow-root
-- 
GitLab