Skip to content

Commit 9adc9b9

Browse files
authored
Merge pull request #257 from nmfs-opensci/test
add R kernel
2 parents 68fda98 + fd32c08 commit 9adc9b9

2 files changed

Lines changed: 18 additions & 11 deletions

File tree

Dockerfile

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ FROM ghcr.io/nmfs-opensci/py-rocket-base/base-image:latest
33
LABEL org.opencontainers.image.maintainers="eli.holmes@noaa.gov"
44
LABEL org.opencontainers.image.author="eli.holmes@noaa.gov"
55
LABEL org.opencontainers.image.source=https://github.com/nmfs-opensci/py-rocket-base
6-
LABEL org.opencontainers.image.description="Python (3.12), R (4.4.2), Desktop and Publishing tools"
6+
LABEL org.opencontainers.image.description="Python (3.12), R (4.4.3), Desktop and Publishing tools"
77
LABEL org.opencontainers.image.licenses=Apache2.0
8-
LABEL org.opencontainers.image.version=2025.03.13
8+
LABEL org.opencontainers.image.version=2025.04.11
99

1010
USER root
1111

@@ -14,7 +14,7 @@ USER root
1414
# Set QUARTO_VERSION due to Jupyter Lab bug with version 1.6 that won't all qmd to open
1515
ENV REPO_DIR="/srv/repo" \
1616
DISPLAY=":1.0" \
17-
R_VERSION="4.4.2" \
17+
R_VERSION="4.4.3" \
1818
QUARTO_VERSION="1.5.57" \
1919
UBUNTU_VERSION="jammy"
2020
ENV LANG=en_US.UTF-8
@@ -51,6 +51,15 @@ RUN /pyrocket_scripts/install-conda-packages.sh ${REPO_DIR}/environment.yml
5151
# Be aware that if R_VERSION_PULL is set to the latest release, CRAN repo will use "latest" and date will not be pinned.
5252
RUN R_VERSION_PULL="master" /pyrocket_scripts/install-rocker.sh "verse_${R_VERSION}"
5353

54+
# Install IRkernel and register it with Jupyter so we can select an R kernel with Jupyter Lab
55+
# When R is invoked, the PATH is cleaned to remove conda, but need to add conda on temporarily so that
56+
# installspec can find jupyter (which is in conda dir)
57+
RUN Rscript - <<EOF
58+
install.packages('IRkernel')
59+
Sys.setenv(PATH = paste("/srv/conda/envs/notebook/bin", Sys.getenv("PATH"), sep = ":"))
60+
IRkernel::installspec(name = "ir443", displayname = "R 4.4.3")
61+
EOF
62+
5463
# Install Zotero; must be run before apt since zotero apt install requires this is run first
5564
RUN wget -qO- https://raw.githubusercontent.com/retorquere/zotero-deb/master/install.sh | bash
5665

@@ -85,15 +94,15 @@ RUN mkdir -p ${XDG_CONFIG_HOME} && \
8594
# Fix home permissions. Not needed in JupyterHub with persistent memory but needed if not used in that context
8695
RUN /pyrocket_scripts/fix-home-permissions.sh
8796

88-
# Allow user to change the rstudio server conf if needed.
89-
RUN chown jovyan:users /etc/rstudio/rserver.conf
90-
91-
# Create a symlink for python to python3 and gh-scoped-creds for all users; need for RStudio sinc conda not on path
97+
# Create a symlink for python to python3 and gh-scoped-creds for all users; need for RStudio since conda not on path
9298
RUN ln -s /usr/bin/python3 /usr/local/bin/python
9399
RUN ln -s /srv/conda/envs/notebook/bin/gh-scoped-creds /usr/local/bin/gh-scoped-creds
94100
RUN ln -s /srv/conda/condabin/conda /usr/local/bin/conda
95101
RUN ln -s /srv/conda/envs/notebook/bin/pip /usr/local/bin/pip
96-
102+
103+
# Allow user to change the rstudio server conf if needed.
104+
RUN chown jovyan:users /etc/rstudio/rserver.conf
105+
97106
# Set up the start command
98107
USER ${NB_USER}
99108
RUN chmod +x ${REPO_DIR}/start \

environment.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@ dependencies:
1414

1515
# R/RStudio Support
1616
- jupyter-rsession-proxy
17-
# Run R in Jupyter Lab
18-
- r-irkernel
19-
17+
2018
# VS Code support
2119
- jupyter-vscode-proxy
2220
- code-server=4.98.0 # Pin to prevent downgrades when conda env is updated

0 commit comments

Comments
 (0)