From 65783fea26ad16595a2bc861ae9b26da6e690784 Mon Sep 17 00:00:00 2001
From: lukken <lukken@astron.nl>
Date: Wed, 16 Mar 2022 15:47:17 +0000
Subject: [PATCH] L2SS-665: Install pip packages as user

---
 bin/start-ds.sh                   | 2 +-
 docker-compose/jupyter/Dockerfile | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/bin/start-ds.sh b/bin/start-ds.sh
index 948582020..b9b958ecd 100755
--- a/bin/start-ds.sh
+++ b/bin/start-ds.sh
@@ -35,7 +35,7 @@ else
   mkdir -p /tmp/tangostationcontrol
   python3 setup.py build --build-base /tmp/tangostationcontrol egg_info --egg-base /tmp/tangostationcontrol bdist_wheel --dist-dir /tmp/tangostationcontrol || exit 1
   # shellcheck disable=SC2012
-  sudo pip install "$(ls -Art /tmp/tangostationcontrol/*.whl | tail -n 1)"
+  pip install "$(ls -Art /tmp/tangostationcontrol/*.whl | tail -n 1)"
 fi
 
 # Return to the stored the directory, this preserves the working_dir argument in
diff --git a/docker-compose/jupyter/Dockerfile b/docker-compose/jupyter/Dockerfile
index cc1652e4a..0626e0f06 100644
--- a/docker-compose/jupyter/Dockerfile
+++ b/docker-compose/jupyter/Dockerfile
@@ -6,8 +6,8 @@ FROM ${SOURCE_IMAGE}
 ARG CONTAINER_EXECUTION_UID=1000
 
 # Create homedir
-ENV HOME=/home/user
-RUN sudo mkdir -p ${HOME}
+RUN sudo adduser --uid ${CONTAINER_EXECUTION_UID} --gid ${CONTAINER_EXECUTION_UID} --home ${HOME} user || exit 0
+RUN sudo echo "PATH=${HOME}/.local/bin:\$PATH" >> ~/.bashrc
 RUN sudo chown ${CONTAINER_EXECUTION_UID} -R ${HOME}
 
 COPY requirements.txt ./
-- 
GitLab