Skip to content

Commit

Permalink
Update Docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
briank-git committed Apr 18, 2024
1 parent 475c70b commit 04e7990
Show file tree
Hide file tree
Showing 8 changed files with 803 additions and 81 deletions.
20 changes: 9 additions & 11 deletions dockerfiles/r-stat-301-grading/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
# Copyright (c) UBC-DSCI Development Team.
# Distributed under the terms of the Modified BSD License.
FROM ubcdsci/r-stat-301:latest

LABEL maintainer="Tiffany Timbers <[email protected]>"
# TODO: For testing purposes only, change back to ubcdsci/r-stat-301:latest
FROM ubcstatit/r-stat-301-student:latest

# install the rise slides extension
RUN mamba install --quiet --yes "rise"
LABEL maintainer="Brian Kim <[email protected]>"

# 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
# install rise slides extension, nbgrader, clean cache
RUN mamba install --quiet --yes \
'nbgrader=0.8.2' && \
mamba clean --all -f -y

# Clean the cache
RUN mamba clean --all -f -y
# re-upgrade jupyter-server (mamba downgrades it)
RUN pip install --upgrade jupyter-server
114 changes: 56 additions & 58 deletions dockerfiles/r-stat-301/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,67 +1,65 @@
# 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

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 "install.packages('faux', repos='http://cran.us.r-project.org')" && \
Rscript -e "install.packages('moderndive', repos='http://cran.us.r-project.org')"

# 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 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-janitor' \
'r-mltools' \
'r-leaps' \
'r-faraway' \
'r-glmnet' \
'r-titanic' \
'r-performance' \
'r-binom' \
'r-gridgraphics' \
'r-aer' \
'r-latex2exp' \
'r-gsdesign' \
'r-car' \
'r-cardata' \
'r-mlbench' \
'r-qqplotr' \
'r-see' \
'r-boot' \
'r-caret' \
&& 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('faux', repos='http://cran.us.r-project.org')" \
&& Rscript -e "install.packages('contextual', repos='http://cran.us.r-project.org')" \
&& Rscript -e "install.packages('ISLR', repos='http://cran.us.r-project.org')" \
&& Rscript -e "install.packages('ISLR2', repos='http://cran.us.r-project.org')" \
&& Rscript -e "install.packages('glmbb', repos='http://cran.us.r-project.org')"

# 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 04e7990

Please sign in to comment.