From e9dc7beb952a48a954761109984340b4a4bdebfd Mon Sep 17 00:00:00 2001 From: Eli Holmes - NOAA Date: Mon, 21 Oct 2024 22:17:04 -0700 Subject: [PATCH 01/12] Update environment.yml --- environment.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/environment.yml b/environment.yml index daeebdb..195f8fd 100644 --- a/environment.yml +++ b/environment.yml @@ -62,4 +62,4 @@ dependencies: - pip - pip: # Access linux desktop from inside JupyterHub - - jupyter-desktop-server==0.1.3 + - jupyter-remote-desktop-proxy From 2a9874ded831bad882934a5ff16522a35e9e5f8a Mon Sep 17 00:00:00 2001 From: Eli Holmes - NOAA Date: Mon, 21 Oct 2024 22:20:44 -0700 Subject: [PATCH 02/12] Update apt-extras.txt --- apt-extras.txt | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/apt-extras.txt b/apt-extras.txt index 7cce795..754a95e 100644 --- a/apt-extras.txt +++ b/apt-extras.txt @@ -36,7 +36,8 @@ build-essential gfortran # Dependencies for nbconvert and myst -# texlive is installed by R installation but not some of the common packages +# texlive is installed by R installation +# Add packages with tlmgr in rocker.sh # Other useful document-related tools # pandoc installed by R installation @@ -58,14 +59,17 @@ tig # console UI for git multitail tree -## This section adds tools needed for desktop environment +# This section adds tools needed for desktop environment +# https://github.com/jupyterhub/jupyter-remote-desktop-proxy dbus-x11 +xfce4 +xfce4-panel +xfce4-session +xfce4-settings xorg xubuntu-icon-theme -xfce4 -xfce4-goodies -xclip -xsel +tigervnc-standalone-server +tigervnc-xorg-extension # GUI text editors emacs From c3f823c61d6b62283ffa3e1c9d7b1c4814dee19e Mon Sep 17 00:00:00 2001 From: Eli Holmes - NOAA Date: Tue, 22 Oct 2024 17:02:54 -0700 Subject: [PATCH 03/12] copy . to pyrocket-child in ONBUILD --- appendix | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/appendix b/appendix index 39653af..773273c 100644 --- a/appendix +++ b/appendix @@ -26,9 +26,16 @@ RUN yes | unminimize ENV MANPATH="${NB_PYTHON_PREFIX}/share/man:${MANPATH}" RUN mandb +# Clean up extra files in ${REPO_DIR} +RUN rm -rf ${REPO_DIR}/book ${REPO_DIR}/docs + # Copy Desktop files into ${REPO_DIR}/Desktop if they exist -ONBUILD RUN mkdir -p ${REPO_DIR}/Desktop && \ - if [ -d Desktop ]; then cp Desktop/* ${REPO_DIR}/Desktop/; fi +ONBUILD COPY . /pyrocket-child/ +ONBUILD RUN if [ -d /pyrocket-child/Desktop ]; then \ + mkdir -p ${REPO_DIR}/Desktop && \ + cp -r /pyrocket-child/Desktop/* ${REPO_DIR}/Desktop/; \ + fi && \ + rm -rf /pyrocket-child # Revert to default user USER ${NB_USER} From 6d7231d7f1cbe3281bacf95726e01ef600330867 Mon Sep 17 00:00:00 2001 From: Eli Holmes - NOAA Date: Tue, 22 Oct 2024 18:04:25 -0700 Subject: [PATCH 04/12] copy . to repo_dir --- appendix | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/appendix b/appendix index 773273c..7fda650 100644 --- a/appendix +++ b/appendix @@ -29,13 +29,13 @@ RUN mandb # Clean up extra files in ${REPO_DIR} RUN rm -rf ${REPO_DIR}/book ${REPO_DIR}/docs -# Copy Desktop files into ${REPO_DIR}/Desktop if they exist -ONBUILD COPY . /pyrocket-child/ -ONBUILD RUN if [ -d /pyrocket-child/Desktop ]; then \ +# Copy Desktop files into ${REPO_DIR}/Desktop if they exist. First copy files to tmpbuild +ONBUILD COPY . ${REPO_DIR}/tmpbuild/ +ONBUILD RUN if [ -d ${REPO_DIR}/tmpbuild/Desktop ]; then \ mkdir -p ${REPO_DIR}/Desktop && \ - cp -r /pyrocket-child/Desktop/* ${REPO_DIR}/Desktop/; \ + cp -r ${REPO_DIR}/tmpbuild/Desktop/* ${REPO_DIR}/Desktop/; \ fi && \ - rm -rf /pyrocket-child + rm -rf ${REPO_DIR}/tmpbuild/ # Revert to default user USER ${NB_USER} From 1ccf23dd8f5f06d10c566443bbe713e57ae920b6 Mon Sep 17 00:00:00 2001 From: Eli Holmes - NOAA Date: Tue, 22 Oct 2024 18:39:12 -0700 Subject: [PATCH 05/12] try copying files again --- appendix | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/appendix b/appendix index 7fda650..469e2ee 100644 --- a/appendix +++ b/appendix @@ -30,12 +30,12 @@ RUN mandb RUN rm -rf ${REPO_DIR}/book ${REPO_DIR}/docs # Copy Desktop files into ${REPO_DIR}/Desktop if they exist. First copy files to tmpbuild -ONBUILD COPY . ${REPO_DIR}/tmpbuild/ -ONBUILD RUN if [ -d ${REPO_DIR}/tmpbuild/Desktop ]; then \ +ONBUILD COPY . /tmpbuild/ +ONBUILD RUN if [ -d /tmpbuild/Desktop ]; then \ mkdir -p ${REPO_DIR}/Desktop && \ - cp -r ${REPO_DIR}/tmpbuild/Desktop/* ${REPO_DIR}/Desktop/; \ - fi && \ - rm -rf ${REPO_DIR}/tmpbuild/ + cp -r /tmpbuild/Desktop/* ${REPO_DIR}/Desktop/; \ + fi +ONBUILD RUN whoami && rm -rf /tmpbuild # Revert to default user USER ${NB_USER} From eca6c66b338c524317b37fb7365548dd6f92f475 Mon Sep 17 00:00:00 2001 From: Eli Holmes - NOAA Date: Tue, 22 Oct 2024 19:27:18 -0700 Subject: [PATCH 06/12] ONBUILD USER root --- appendix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/appendix b/appendix index 469e2ee..7458eca 100644 --- a/appendix +++ b/appendix @@ -30,12 +30,14 @@ RUN mandb RUN rm -rf ${REPO_DIR}/book ${REPO_DIR}/docs # Copy Desktop files into ${REPO_DIR}/Desktop if they exist. First copy files to tmpbuild +ONBUILD USER root ONBUILD COPY . /tmpbuild/ ONBUILD RUN if [ -d /tmpbuild/Desktop ]; then \ mkdir -p ${REPO_DIR}/Desktop && \ cp -r /tmpbuild/Desktop/* ${REPO_DIR}/Desktop/; \ fi ONBUILD RUN whoami && rm -rf /tmpbuild +ONBUILD USER ${NB_USER} # Revert to default user USER ${NB_USER} From 0e3227cdcfef6c311924d3ec730970eade50bd38 Mon Sep 17 00:00:00 2001 From: Eli Holmes - NOAA Date: Wed, 23 Oct 2024 09:22:30 -0700 Subject: [PATCH 07/12] Update start --- start | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/start b/start index e145224..c26d494 100644 --- a/start +++ b/start @@ -28,8 +28,10 @@ mkdir -p "${DESKTOP_DIR}" for desktop_file_path in ${REPO_DIR}/Desktop/*.desktop; do cp "${desktop_file_path}" "${APPLICATIONS_DIR}/." - # Symlink application to desktop + # Symlink application to desktop and set execute permission so xfce (desktop) doesn't complain desktop_file_name="$(basename ${desktop_file_path})" + # Set execute permissions on the copied .desktop file + chmod +x "${APPLICATIONS_DIR}/${desktop_file_name}" ln -sf "${APPLICATIONS_DIR}/${desktop_file_name}" "${DESKTOP_DIR}/${desktop_file_name}" done update-desktop-database "${APPLICATIONS_DIR}" From eb13078e9129d27b0e394afb15422654ffcdd35a Mon Sep 17 00:00:00 2001 From: Eli Holmes - NOAA Date: Wed, 23 Oct 2024 10:12:35 -0700 Subject: [PATCH 08/12] Update appendix --- appendix | 1 + 1 file changed, 1 insertion(+) diff --git a/appendix b/appendix index 7458eca..8140ff1 100644 --- a/appendix +++ b/appendix @@ -38,6 +38,7 @@ ONBUILD RUN if [ -d /tmpbuild/Desktop ]; then \ fi ONBUILD RUN whoami && rm -rf /tmpbuild ONBUILD USER ${NB_USER} +ONBUILD RUN whoami # Revert to default user USER ${NB_USER} From 0c360c02e68b839a1a7f59decb9de9ffd7740410 Mon Sep 17 00:00:00 2001 From: Eli Holmes - NOAA Date: Wed, 23 Oct 2024 12:18:37 -0700 Subject: [PATCH 09/12] Update start --- start | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/start b/start index c26d494..2b0b289 100644 --- a/start +++ b/start @@ -1,14 +1,15 @@ #!/bin/bash set -euo pipefail -# Set any environment variables here +# Start - Set any environment variables here # These are inherited by all processes, *except* RStudio - -# Tell applications where to open desktop apps - this allows notebooks to -# pop open GUIs +# USE export =value +# Tell applications where to open desktop apps - this allows notebooks to pop open GUIs export DISPLAY=":1.0" # source this file to get the variables defined in the rocker Dockerfile source ${REPO_DIR}/env.txt +# End - Set any environment variables here + # The for loops will fail if they return null (no files). Set shell option nullglob shopt -s nullglob From ba5417f53cb01341081887c06ae9f7865d1909da Mon Sep 17 00:00:00 2001 From: Eli Holmes - NOAA Date: Wed, 23 Oct 2024 12:36:52 -0700 Subject: [PATCH 10/12] Update appendix --- appendix | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/appendix b/appendix index 8140ff1..e72e86f 100644 --- a/appendix +++ b/appendix @@ -29,9 +29,15 @@ RUN mandb # Clean up extra files in ${REPO_DIR} RUN rm -rf ${REPO_DIR}/book ${REPO_DIR}/docs -# Copy Desktop files into ${REPO_DIR}/Desktop if they exist. First copy files to tmpbuild +# Set up behavior for child dockerfiles +# Define NB_USER since that is not exported by the parent dockerfile (py-rocket-base) +# This works because py-rocket-base sets user to NB_USER +ONBUILD RUN export NB_USER=$(whoami) +ONBUILD ENV NB_USER=${NB_USER} + ONBUILD USER root ONBUILD COPY . /tmpbuild/ +# Copy Desktop files into ${REPO_DIR}/Desktop if they exist. First copy files to tmpbuild ONBUILD RUN if [ -d /tmpbuild/Desktop ]; then \ mkdir -p ${REPO_DIR}/Desktop && \ cp -r /tmpbuild/Desktop/* ${REPO_DIR}/Desktop/; \ From 27cc0a5a065c5504e2676eeb35802575b65c4f47 Mon Sep 17 00:00:00 2001 From: Eli Holmes - NOAA Date: Wed, 23 Oct 2024 13:45:11 -0700 Subject: [PATCH 11/12] Update appendix --- appendix | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/appendix b/appendix index e72e86f..8479822 100644 --- a/appendix +++ b/appendix @@ -30,10 +30,8 @@ RUN mandb RUN rm -rf ${REPO_DIR}/book ${REPO_DIR}/docs # Set up behavior for child dockerfiles -# Define NB_USER since that is not exported by the parent dockerfile (py-rocket-base) -# This works because py-rocket-base sets user to NB_USER -ONBUILD RUN export NB_USER=$(whoami) -ONBUILD ENV NB_USER=${NB_USER} +# Convert NB_USER to ENV (from ARG) so that it passes to the child dockerfile +ENV NB_USER=${NB_USER} ONBUILD USER root ONBUILD COPY . /tmpbuild/ From c2fb15dede4854d8f6c5886d8ce688073588b2ba Mon Sep 17 00:00:00 2001 From: Eli Holmes - NOAA Date: Wed, 23 Oct 2024 15:47:17 -0700 Subject: [PATCH 12/12] fix permissions when copy child files in --- appendix | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/appendix b/appendix index 8479822..a4cbac9 100644 --- a/appendix +++ b/appendix @@ -33,16 +33,14 @@ RUN rm -rf ${REPO_DIR}/book ${REPO_DIR}/docs # Convert NB_USER to ENV (from ARG) so that it passes to the child dockerfile ENV NB_USER=${NB_USER} -ONBUILD USER root -ONBUILD COPY . /tmpbuild/ -# Copy Desktop files into ${REPO_DIR}/Desktop if they exist. First copy files to tmpbuild -ONBUILD RUN if [ -d /tmpbuild/Desktop ]; then \ +# ${REPO_DIR} is owned by ${NB_USER} +ONBUILD COPY --chown=${NB_USER}:${NB_USER} . ${REPO_DIR}/childimage +# Copy Desktop files into ${REPO_DIR}/Desktop if they exist. start will copy to Application dir and Desktop +ONBUILD RUN if [ -d ${REPO_DIR}/childimage/Desktop ]; then \ mkdir -p ${REPO_DIR}/Desktop && \ - cp -r /tmpbuild/Desktop/* ${REPO_DIR}/Desktop/; \ + cp -r ${REPO_DIR}/childimage/Desktop/* ${REPO_DIR}/Desktop/; \ fi -ONBUILD RUN whoami && rm -rf /tmpbuild -ONBUILD USER ${NB_USER} -ONBUILD RUN whoami -# Revert to default user +# Revert to default user and home as pwd USER ${NB_USER} +WORKDIR ${HOME}