Skip to content

Commit

Permalink
Update Docker images
Browse files Browse the repository at this point in the history
  • Loading branch information
briank-git committed Apr 18, 2024
1 parent 80380df commit 61f309d
Show file tree
Hide file tree
Showing 8 changed files with 793 additions and 61 deletions.
20 changes: 9 additions & 11 deletions dockerfiles/r-stat-201-grading/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
# Copyright (c) UBC-STAT Development Team.
# Distributed under the terms of the Modified BSD License.
FROM ubcstat/r-stat-201:latest
# TODO: For testing purposes only, change to ubcstat/r-stat-201:latest
FROM ubcstatit/r-stat-201-student:latest

LABEL maintainer="Tiffany Timbers <tiffany.timbers@stat.ubc.ca>"
LABEL maintainer="Brian Kim <brian.kim@stat.ubc.ca>"

# install the rise slides extension
RUN mamba install --quiet --yes "rise"
# install rise slides extension, nbgrader, clean cache
RUN mamba install --quiet --yes \
'nbgrader=0.8.2' && \
mamba clean --all -f -y

# install nbgrader
RUN mamba install --quiet --yes "nbgrader=0.7.1" \
&& jupyter nbextension install --sys-prefix --py nbgrader --overwrite \
&& jupyter nbextension enable --sys-prefix --py nbgrader \
&& jupyter serverextension enable --sys-prefix --py nbgrader
# re-upgrade jupyter-server (mamba downgrades it)
RUN pip install --upgrade jupyter-server

# Clean the cache
RUN mamba clean --all -f -y
95 changes: 57 additions & 38 deletions dockerfiles/r-stat-201/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,47 +1,66 @@
# Copyright (c) UBC-DSCI Development Team.
# Distributed under the terms of the Modified BSD License.
FROM jupyter/r-notebook
FROM jupyter/minimal-notebook

LABEL maintainer="Tiffany Timbers <[email protected]>"
LABEL maintainer="Brian Kim <[email protected]>"

SHELL ["/bin/bash", "-o", "pipefail", "-c"]

USER root

# install vim
RUN apt-get update && apt-get install -y vim
# R pre-requisites
RUN apt-get update --yes && \
apt-get install --yes --no-install-recommends \
fonts-dejavu \
unixodbc \
unixodbc-dev \
r-cran-rodbc \
gfortran \
gcc \
vim && \
apt-get clean && rm -rf /var/lib/apt/lists/*

USER ${NB_UID}

# Change workdir to $HOME/work so config files are preserved when bind mounting
WORKDIR "${HOME}/work"

# disable warnings that pollute build logs; seems to be related to the update to python 3.11
# https://discourse.jupyter.org/t/debugger-warning-it-seems-that-frozen-modules-are-being-used-python-3-11-0/16544/12
ENV PYDEVD_DISABLE_FILE_VALIDATION=1

COPY conda-linux-64.lock /tmp/conda-linux-64.lock

# Install R packages from lock file.
RUN mamba update --quiet --file /tmp/conda-linux-64.lock && \
mamba clean --all -y -f && \
# fix-permissions "${CONDA_DIR}" && \
# fix-permissions "/home/${NB_USER}" && \
Rscript -e "devtools::install_github('UBC-MDS/[email protected]')" && \
Rscript -e "devtools::install_github('UBC-MDS/[email protected]')"

# Install pexpect from main branch to fix asyncio issue with jupyterlab_git
RUN pip install --ignore-installed git+https://github.com/pexpect/pexpect.git@master

# Disable the cell toolbar (which ignores metadata and students often accidentally click + delete grading cells)
RUN jupyter labextension disable @jupyterlab/cell-toolbar-extension

# Disable announcement pop-up on start
RUN jupyter labextension disable "@jupyterlab/apputils-extension:announcements"

# Configure shortcuts-extension to remove Shift-M cell merge shortcut
COPY config/shortcuts.jupyterlab-settings /home/${NB_USER}/.jupyter/lab/user-settings/\@jupyterlab/shortcuts-extension/shortcuts.jupyterlab-settings

# Copy jupyter_server_config.py which allows students to see and delete hidden files
COPY config/jupyter_server_config.py /home/${NB_USER}/.jupyter

# Copy gitconfig that sets global default pull strategy to rebase
COPY config/.gitconfig /home/${NB_USER}/

# Make sure everything in the home folder is owned by NB_USER for running docker image locally.
USER root
RUN chown -R ${NB_USER} /home/${NB_USER}
USER ${NB_UID}

WORKDIR "${HOME}"

# remove the "work/" directory added in an earlier layer...
RUN rm -rf work

# Install R packages
RUN mamba install --quiet --yes \
'r-cowplot' \
'r-ggally' \
'r-gridextra' \
'r-infer' \
'r-kknn' \
'r-testthat' \
'r-rpostgres' \
'r-memoise' \
&& mamba clean --all -f -y \
&& fix-permissions "${CONDA_DIR}" \
&& fix-permissions "/home/${NB_USER}" \
&& Rscript -e "remotes::install_github('allisonhorst/[email protected]')" \
&& Rscript -e "install.packages('ISLR', repos='http://cran.us.r-project.org')" \
&& Rscript -e "devtools::install_github('UBC-MDS/[email protected]')" \
&& Rscript -e "devtools::install_github('UBC-MDS/[email protected]')"

# Install nbgitpuller, jupytext, jlab-git
RUN pip install git+https://github.com/data-8/nbgitpuller@c23461d4f7ce47ec4e0d2bcfc3b2fde4939b80f8 \
&& jupyter serverextension enable --sys-prefix nbgitpuller \
&& pip install jupyterlab-git \
&& pip install jupytext --upgrade \
&& jupyter labextension install @techrah/text-shortcuts \
&& jupyter lab build

# Install the extension to remove the shift+M merge shortcut
RUN mkdir -p /home/${NB_USER}/.jupyter/lab/user-settings/\@jupyterlab/shortcuts-extension
COPY rm-merge-shortcut.py /home/${NB_USER}/.jupyter/lab/user-settings/\@jupyterlab/shortcuts-extension/shortcuts.jupyterlab-settings
# Disable HEALTHCHECK for performance reasons
HEALTHCHECK NONE
Loading

0 comments on commit 61f309d

Please sign in to comment.