From 456febf65c7a6397a77c62d5ce1566ca7633ccaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Quentin=20G=C3=A9r=C3=B4me?= Date: Wed, 20 Nov 2024 15:36:03 +0100 Subject: [PATCH] fix: set the USER for the blsq image; remove g+w on the wrap_up.py & merge install.packages together --- images/base/files/scripts/fuse_mount.py | 4 +++- images/base/files/scripts/wrap_up.py | 1 - images/blsq/Dockerfile | 6 +++--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/images/base/files/scripts/fuse_mount.py b/images/base/files/scripts/fuse_mount.py index 4ad1313..c2505bc 100644 --- a/images/base/files/scripts/fuse_mount.py +++ b/images/base/files/scripts/fuse_mount.py @@ -47,8 +47,10 @@ def do_GET(self): args = [ "gcsfuse", "-o", - "allow_other", + "rw", "--implicit-dirs", # Also create implicit directories structure (i.e. key /a/b/c/d will create /a, /a/b, /a/b/c) + "--uid=1000", # jovyan user id + "--gid=100", # users group id ] # Use the custom token server to get the token diff --git a/images/base/files/scripts/wrap_up.py b/images/base/files/scripts/wrap_up.py index 2c581d2..03b29a1 100644 --- a/images/base/files/scripts/wrap_up.py +++ b/images/base/files/scripts/wrap_up.py @@ -7,5 +7,4 @@ # subprocess.run(["chmod", "a-w", "/home/jovyan"]) # Make /home/jovyan/worskpace + /home/jovyan/tmp writable -subprocess.run(["chmod", "g+w", "/home/jovyan/workspace"]) subprocess.run(["chmod", "g+w", "/home/jovyan/tmp"]) diff --git a/images/blsq/Dockerfile b/images/blsq/Dockerfile index 3a57801..ea825fe 100644 --- a/images/blsq/Dockerfile +++ b/images/blsq/Dockerfile @@ -10,8 +10,7 @@ USER root RUN apt-get update && apt-get install -y libgdal-dev libudunits2-dev # R packages (only available on cran) -RUN R -e "install.packages('GISTools', dependencies=TRUE, quiet=TRUE, repos='https://cran.r-project.org/')" && \ - R -e "install.packages('OpenStreetMap', dependencies=TRUE, quiet=TRUE, repos='https://cran.r-project.org/')" +RUN R -e "options(Ncpus = parallel::detectCores()); install.packages(c('GISTools', 'OpenStreetMap'), dependencies=TRUE, quiet=TRUE, repos='https://cran.r-project.org/', Ncpus=parallel::detectCores())" # R packages on R channel RUN conda install --yes -c R \ @@ -80,4 +79,5 @@ RUN conda install --yes -c conda-forge -c R\ conda clean --all -y # Set PYTHONUNBUFFERED to ensure that Python output is sent straight to terminal -ENV PYTHONUNBUFFERED=1 \ No newline at end of file +ENV PYTHONUNBUFFERED=1 +USER ${NB_UID} \ No newline at end of file