generated from berkeley-dsep-infra/hub-user-image-template
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bringing in image directory from deployment repo
- Loading branch information
Showing
13 changed files
with
328 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
FROM ghcr.io/rocker-org/geospatial:4.4.1 | ||
|
||
ENV NB_USER rstudio | ||
ENV NB_UID 1000 | ||
ENV CONDA_DIR /srv/conda | ||
|
||
# Set ENV for all programs... | ||
ENV PATH ${CONDA_DIR}/bin:$PATH | ||
|
||
# And set ENV for R! It doesn't read from the environment... | ||
RUN echo "PATH=${PATH}" >> /usr/local/lib/R/etc/Renviron.site | ||
|
||
# Add PATH to /etc/profile so it gets picked up by the terminal | ||
RUN echo "PATH=${PATH}" >> /etc/profile | ||
RUN echo "export PATH" >> /etc/profile | ||
|
||
ENV HOME /home/${NB_USER} | ||
|
||
WORKDIR ${HOME} | ||
|
||
# Install packages needed by notebook-as-pdf | ||
# nodejs for installing notebook / jupyterhub from source | ||
# libarchive-dev for https://github.com/berkeley-dsep-infra/datahub/issues/1997 | ||
# texlive-xetex pulls in texlive-latex-extra > texlive-latex-recommended | ||
# We use Ubuntu's TeX because rocker's doesn't have most packages by default, | ||
# and we don't want them to be downloaded on demand by students. | ||
# tini is necessary because it is our ENTRYPOINT below. | ||
RUN apt-get update > /dev/null && \ | ||
apt-get install --yes \ | ||
less \ | ||
libx11-xcb1 \ | ||
libxtst6 \ | ||
libxrandr2 \ | ||
libasound2 \ | ||
libpangocairo-1.0-0 \ | ||
libatk1.0-0 \ | ||
libatk-bridge2.0-0 \ | ||
libgtk-3-0 \ | ||
libnss3 \ | ||
libnspr4 \ | ||
libxss1 \ | ||
fonts-symbola \ | ||
gdebi-core \ | ||
tini \ | ||
pandoc \ | ||
texlive-xetex \ | ||
texlive-fonts-recommended \ | ||
texlive-fonts-extra \ | ||
texlive-plain-generic \ | ||
nodejs npm > /dev/null && \ | ||
apt-get clean && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
COPY install-mambaforge.bash /tmp/install-mambaforge.bash | ||
RUN /tmp/install-mambaforge.bash | ||
|
||
USER ${NB_USER} | ||
|
||
COPY environment.yml /tmp/environment.yml | ||
RUN mamba env update -p ${CONDA_DIR} -f /tmp/environment.yml && \ | ||
mamba clean -afy | ||
|
||
COPY infra-requirements.txt /tmp/infra-requirements.txt | ||
RUN pip install --no-cache-dir -r /tmp/infra-requirements.txt | ||
|
||
# DH-331, very similar to what was done for datahub in DH-164 | ||
ENV PLAYWRIGHT_BROWSERS_PATH ${CONDA_DIR} | ||
RUN playwright install chromium | ||
|
||
# Install IRKernel | ||
RUN R --quiet -e "install.packages('IRkernel', quiet = TRUE)" && \ | ||
R --quiet -e "IRkernel::installspec(prefix='${CONDA_DIR}')" | ||
|
||
COPY class-libs.R /tmp/class-libs.R | ||
RUN mkdir -p /tmp/r-packages | ||
|
||
# Workaround to install ottr, issue 3342 | ||
#RUN wget https://github.com/ucbds-infra/ottr/archive/refs/tags/0.1.0.tar.gz -O /tmp/ottr.tar.gz && R CMD INSTALL /tmp/ottr.tar.gz && rm /tmp/ottr.tar.gz | ||
|
||
#COPY install.R /tmp/install.R | ||
#RUN /tmp/install.R && rm -rf /tmp/downloaded_packages | ||
|
||
COPY r-packages/ottr.r /tmp/r-packages/ | ||
RUN r /tmp/r-packages/ottr.r | ||
|
||
COPY r-packages/ph-290.r /tmp/r-packages/ | ||
RUN r /tmp/r-packages/ph-290.r | ||
|
||
COPY r-packages/ph-142.r /tmp/r-packages/ | ||
RUN r /tmp/r-packages/ph-142.r | ||
|
||
COPY r-packages/ph-252.r /tmp/r-packages/ | ||
RUN r /tmp/r-packages/ph-252.r | ||
|
||
COPY r-packages/2021-spring-phw-272a.r /tmp/r-packages/ | ||
RUN r /tmp/r-packages/2021-spring-phw-272a.r | ||
|
||
# Use simpler locking strategy | ||
COPY file-locks /etc/rstudio/file-locks | ||
|
||
ENTRYPOINT ["tini", "--"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/usr/bin/env Rscript | ||
|
||
class_libs_install_version <- function(class_name, class_libs) { | ||
print(paste("Installing packages for", class_name)) | ||
for (i in seq(1, length(class_libs), 2)) { | ||
installed_packages <- rownames(installed.packages()) | ||
package_name = class_libs[i] | ||
version = class_libs[i+1] | ||
# Only install packages if they haven't already been installed! | ||
# devtools doesn't do that by default | ||
if (!package_name %in% installed_packages) { | ||
print(paste("Installing", package_name, version)) | ||
devtools::install_version(package_name, version, quiet=TRUE) | ||
} else { | ||
# FIXME: This ignores version incompatibilities :'( | ||
print(paste("Not installing", package_name, " as it is already installed")) | ||
} | ||
} | ||
print(paste("Done installing packages for", class_name)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
dependencies: | ||
- pip | ||
- syncthing==1.18.6 | ||
- jupyter-server-proxy==4.2.0 | ||
- jupyter-rsession-proxy==2.2.0 | ||
- pip: | ||
# bug w/notebook and traitlets: https://github.com/jupyter/notebook/issues/7048 | ||
- traitlets==5.9.0 | ||
# - -r /tmp/infra-requirements.txt | ||
# RStudio support | ||
- otter-grader==2.2.7 | ||
# for notebook exporting | ||
- nbconvert[webpdf]==7.16.4 | ||
- nb2pdf==0.6.2 | ||
- nbpdfexport==0.2.1 | ||
# pulled in by ottr, if not pinned to 1.16.2, 1.16.3 causes DH-323 | ||
- jupytext==1.16.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# https://docs.rstudio.com/ide/server-pro/load_balancing/configuration.html#file-locking | ||
|
||
# rocker sets this to advisory, but this might be causing NFS issues. | ||
# lets set it to the default (default: linkbased) | ||
lock-type=linkbased | ||
|
||
# we'll also reduce the frequency by 1/3 | ||
refresh-rate=60 | ||
timeout-interval=90 | ||
|
||
# log attempts | ||
# enable-logging=1 | ||
# log-file=/tmp/rstudio-locking.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# WARNING: Original source at scripts/infra-packages/requirements.txt | ||
# PLEASE DO NOT EDIT ELSEWHERE | ||
# After editing scripts/infra-packages/requirements.txt, please run | ||
# scripts/infra-packages/sync.bash. | ||
|
||
# This file pins versions of notebook related python packages we want | ||
# across all hubs. This makes sure we don't need to upgrade them | ||
# everwhere one by one. | ||
|
||
# FIXME: Freeze this to get exact versions of all dependencies | ||
notebook==7.0.7 | ||
jupyterlab==4.0.11 | ||
nbgitpuller==1.2.1 | ||
jupyter-resource-usage==1.0.1 | ||
# Matches version in images/hub/Dockerfile | ||
jupyterhub==4.1.6 | ||
appmode==0.8.0 | ||
ipywidgets==8.0.7 | ||
jupyter-tree-download==1.0.1 | ||
git-credential-helpers==0.2 | ||
# Measure popularity of different packages in our hubs | ||
# https://discourse.jupyter.org/t/request-for-implementation-instrument-libraries-actively-used-by-users-on-a-jupyterhub/7994?u=yuvipanda | ||
git+https://github.com/shaneknapp/python-popularity-contest.git@add-error-handling | ||
# RISE is useful for presentations - see https://github.com/berkeley-dsep-infra/datahub/issues/2527 | ||
RISE==5.7.1 | ||
# syncthing for dropbox-like functionality | ||
jupyter-syncthing-proxy==1.0.3 | ||
# jupyter archival tool for easy user downloads | ||
jupyter-archive==3.4.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/bin/bash | ||
# This downloads and installs a pinned version of mambaforge | ||
set -ex | ||
|
||
cd $(dirname $0) | ||
MAMBAFORGE_VERSION=22.9.0-2 | ||
|
||
URL="https://github.com/conda-forge/miniforge/releases/download/${MAMBAFORGE_VERSION}/Mambaforge-${MAMBAFORGE_VERSION}-Linux-x86_64.sh" | ||
INSTALLER_PATH=/tmp/mambaforge-installer.sh | ||
|
||
# make sure we don't do anything funky with user's $HOME | ||
# since this is run as root | ||
unset HOME | ||
|
||
wget --quiet $URL -O ${INSTALLER_PATH} | ||
chmod +x ${INSTALLER_PATH} | ||
|
||
bash ${INSTALLER_PATH} -b -p ${CONDA_DIR} | ||
export PATH="${CONDA_DIR}/bin:$PATH" | ||
|
||
# Do not attempt to auto update conda or dependencies | ||
conda config --system --set auto_update_conda false | ||
conda config --system --set show_channel_urls true | ||
|
||
# empty conda history file, | ||
# which seems to result in some effective pinning of packages in the initial env, | ||
# which we don't intend. | ||
# this file must not be *removed*, however | ||
echo '' > ${CONDA_DIR}/conda-meta/history | ||
|
||
# Clean things out! | ||
conda clean --all -f -y | ||
|
||
# Remove the big installer so we don't increase docker image size too much | ||
rm ${INSTALLER_PATH} | ||
|
||
# Remove the pip cache created as part of installing mambaforge | ||
rm -rf /root/.cache | ||
|
||
chown -R $NB_USER:$NB_USER ${CONDA_DIR} | ||
|
||
conda list -n root |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/usr/bin/env r | ||
|
||
source("/tmp/class-libs.R") | ||
|
||
# install ottr, needs to go first issue #3216, #3263 | ||
devtools::install_github('ucbds-infra/ottr', ref='0.1.0', upgrade_dependencies=FALSE, quiet=FALSE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"cells": [], | ||
"metadata": {}, | ||
"nbformat": 4, | ||
"nbformat_minor": 4 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/usr/bin/env Rscript | ||
|
||
source("/tmp/class-libs.R") | ||
|
||
class_name = "PHW 272a Spring 2021" | ||
class_libs = c( | ||
"ggmap", "3.0.0", | ||
"tmap", "3.3-2", | ||
"rgdal", "1.5-28" | ||
) | ||
class_libs_install_version(class_name, class_libs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/usr/bin/env Rscript | ||
# From https://github.com/berkeley-dsep-infra/datahub/issues/3403 | ||
|
||
print("Installing packages for ottr") | ||
devtools::install_version("ottr", version = "1.1.4", repos = "https://cran.r-project.org", upgrade = "never", quiet = FALSE) | ||
print("Done installing packages for ottr") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/usr/bin/env Rscript | ||
# From https://github.com/berkeley-dsep-infra/datahub/issues/881 | ||
print("Installing packages for PH142") | ||
|
||
source("/tmp/class-libs.R") | ||
|
||
class_name = "PH142" | ||
|
||
class_libs = c( | ||
"fGarch", "3042.83.2", | ||
"SASxport", "1.7.0", | ||
"googlesheets", "0.3.0", | ||
"googledrive", "1.0.1", | ||
"ggrepel", "0.9.0", | ||
"infer", "0.5.3", | ||
"janitor", "2.1.0", | ||
"latex2exp", "0.4.0", | ||
"measurements", "1.4.0", | ||
"dagitty", "0.3-0", | ||
"cowplot", "1.1.1", | ||
"patchwork", "1.1.1", | ||
"tigris", "1.0", | ||
"googlesheets4", "1.0.0", | ||
"coxed", "0.3.3" | ||
) | ||
|
||
class_libs_install_version(class_name, class_libs) | ||
|
||
print("Done installing packages for PH142") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/usr/bin/env Rscript | ||
# For https://github.com/berkeley-dsep-infra/datahub/issues/2556 | ||
# For https://github.com/berkeley-dsep-infra/datahub/issues/2524 | ||
# For https://github.com/berkeley-dsep-infra/datahub/issues/2748 | ||
# For https://github.com/berkeley-dsep-infra/datahub/issues/2788 | ||
# Fall 2021 | ||
print("Installing packages for PH 252") | ||
|
||
source("/tmp/class-libs.R") | ||
|
||
class_name = "PH 252" | ||
|
||
class_libs = c( | ||
"foreign", "0.8-81", | ||
"blm", "2013.2.4.4", | ||
"geepack", "1.3-2", | ||
"multcomp", "1.4-17", | ||
"epitools", "0.5-10.1", | ||
"rms", "6.2-0", | ||
"lmtest","0.9-38", | ||
"car","3.0-10", | ||
"SurvRegCensCov","1.4", | ||
"ProfileLikelihood","1.1", | ||
"biostat3","0.1.5" | ||
) | ||
|
||
devtools::install_github('cran/epi', ref='06efd3f', upgrade_dependencies=FALSE, quiet=FALSE) | ||
devtools::install_github('kaz-yos/tableone', ref='7cfcd71', upgrade_dependencies=FALSE, quiet=FALSE) | ||
|
||
class_libs_install_version(class_name, class_libs) | ||
|
||
print("Done installing packages for PH 252") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/usr/bin/env Rscript | ||
# For https://github.com/berkeley-dsep-infra/datahub/issues/1921 | ||
print("Installing packages for PH 290W") | ||
|
||
source("/tmp/class-libs.R") | ||
|
||
class_name = "PH 290W" | ||
|
||
class_libs = c( | ||
"kableExtra", "1.3.1", | ||
"plotly", "4.9.2.2", | ||
"ggthemes", "4.2.0", | ||
"formattable", "0.2.1" | ||
) | ||
|
||
class_libs_install_version(class_name, class_libs) |