diff --git a/appendix b/appendix index 7fc349d..a13fbd7 100644 --- a/appendix +++ b/appendix @@ -1,3 +1,10 @@ +LABEL org.opencontainers.image.maintainers="eli.holmes@noaa.gov" +LABEL org.opencontainers.image.author="eli.holmes@noaa.gov" +LABEL org.opencontainers.image.source=https://github.com/nmfs-opensci/py-rocket-base +LABEL org.opencontainers.image.description="JupyterHub image with Python 3.11 and Tidyverse based R 4.4 and RStudio" +LABEL org.opencontainers.image.licenses=Apache2.0 +LABEL org.opencontainers.image.version=2024.11.06 + USER root # Clean up extra files in ${REPO_DIR} @@ -48,6 +55,9 @@ RUN mkdir -p /pyrocket_scripts && cp -r ${REPO_DIR}/scripts/* /pyrocket_scripts/ RUN chown -R root:staff /pyrocket_scripts && \ chmod -R 775 /pyrocket_scripts +# Some basic VS Code extensions +RUN /pyrocket_scripts/install-vscode-ext.sh ${REPO_DIR}/vscode-extensions.txt + # Convert NB_USER to ENV (from ARG) so that it passes to the child dockerfile ENV NB_USER=${NB_USER} diff --git a/scripts/install-vscode-extensions.sh b/scripts/install-vscode-extensions.sh new file mode 100644 index 0000000..f16db56 --- /dev/null +++ b/scripts/install-vscode-extensions.sh @@ -0,0 +1,37 @@ +#!/bin/bash + +# Install VSCode extensions. +# These get installed to $CONDA_PREFIX/envs/notebook/share/code-server/extensions/ + +# Check if a filename argument is provided +if [ -z "$1" ]; then + echo "Error: install-vscode-extensions.sh requires an input file of extension names (typically called vscode-extensions.txt)." >&2 + echo "Usage: RUN /pyrocket_scripts/install-vscode-extensions.sh " + exit 1 +fi + +# Check the user and output which user the script is running as +if [[ $(id -u) -eq 0 ]]; then + echo "Running install-vscode-extensions.sh as root." +else + echo "Running install-vscode-extensions.sh as ${NB_USER}." +fi + +ext_file="$1" + +# Verify that ext_file exists and is a file +if [ ! -f "${ext_file}" ]; then + echo " Error: Specified file '$ext_file' does not exist." + exit 1 +fi + +# Install each extension listed in the file +while IFS= read -r EXT; do + if code-server --install-extension "$EXT"; then + echo " Successfully installed extension: $EXT" + else + echo " Failed to install extension: $EXT" >&2 + fi +done < "$ext_file" + +echo " Success! install-vscode-extensions.sh" diff --git a/scripts/run-postbuild.sh b/scripts/run-postbuild.sh index 9d93a87..fa18769 100644 --- a/scripts/run-postbuild.sh +++ b/scripts/run-postbuild.sh @@ -12,18 +12,19 @@ fi # Set SCRIPT_FILE to the provided argument SCRIPT_FILE="$1" +# Check the user and output which user the script is running as +if [[ $(id -u) -eq 0 ]]; then + echo "Running run-postbuild.sh as root." +else + echo "Running run-postbuild.sh as ${NB_USER}." +fi + # Verify that SCRIPT_FILE exists and is a file if [ ! -f "${SCRIPT_FILE}" ]; then echo " Error: Specified script file '${SCRIPT_FILE}' does not exist." exit 1 fi -# Check the user and output which user the script is running as -if [[ $(id -u) -eq 0 ]]; then - echo " Running run-postbuild.sh as root." -else - echo " Running run-postbuild.sh as ${NB_USER}." -fi # Make the script executable and run it chmod +x "${SCRIPT_FILE}" diff --git a/vscode-extensions.txt b/vscode-extensions.txt new file mode 100644 index 0000000..c64943d --- /dev/null +++ b/vscode-extensions.txt @@ -0,0 +1,3 @@ +ms-python.python +ms-toolsai.jupyter +quarto.quarto