Skip to content

Commit

Permalink
Merge pull request #89 from nmfs-opensci/dev
Browse files Browse the repository at this point in the history
Get ONBUILD to move Desktop files into Desktop working
  • Loading branch information
eeholmes authored Oct 23, 2024
2 parents f0aeedc + c2fb15d commit 95e9ef1
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 16 deletions.
20 changes: 16 additions & 4 deletions appendix
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,21 @@ RUN yes | unminimize
ENV MANPATH="${NB_PYTHON_PREFIX}/share/man:${MANPATH}"
RUN mandb

# 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
# Clean up extra files in ${REPO_DIR}
RUN rm -rf ${REPO_DIR}/book ${REPO_DIR}/docs

# Revert to default user
# Set up behavior for child dockerfiles
# Convert NB_USER to ENV (from ARG) so that it passes to the child dockerfile
ENV NB_USER=${NB_USER}

# ${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 ${REPO_DIR}/childimage/Desktop/* ${REPO_DIR}/Desktop/; \
fi

# Revert to default user and home as pwd
USER ${NB_USER}
WORKDIR ${HOME}
16 changes: 10 additions & 6 deletions apt-extras.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,4 @@ dependencies:
- pip
- pip:
# Access linux desktop from inside JupyterHub
- jupyter-desktop-server==0.1.3
- jupyter-remote-desktop-proxy
13 changes: 8 additions & 5 deletions start
Original file line number Diff line number Diff line change
@@ -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 <parname>=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
Expand All @@ -28,8 +29,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}"
Expand Down

0 comments on commit 95e9ef1

Please sign in to comment.