Skip to content

Commit

Permalink
Merge pull request #14 from ryanlovett/spring-2025
Browse files Browse the repository at this point in the history
Update for Spring 2025.
  • Loading branch information
ryanlovett authored Jan 9, 2025
2 parents bb9fd02 + 6b1bc50 commit 509d361
Show file tree
Hide file tree
Showing 6 changed files with 114 additions and 103 deletions.
29 changes: 16 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM rocker/geospatial:4.4.1
# https://github.com/rocker-org/rocker-versioned2/wiki/geospatial_e06f866673fa
FROM rocker/geospatial:4.4.2
# https://github.com/rocker-org/rocker-versioned2/wiki/geospatial_69e6b17dd7e3

ENV NB_USER=rstudio
ENV NB_UID=1000
Expand Down Expand Up @@ -43,15 +43,15 @@ RUN apt-get update && \

# While quarto is included with rocker/verse, we sometimes need different
# versions than the default. For example a newer version might fix bugs.
ENV _QUARTO_VERSION=1.4.549
ENV _QUARTO_VERSION=1.6.40
RUN curl -L -o /tmp/quarto.deb https://github.com/quarto-dev/quarto-cli/releases/download/v${_QUARTO_VERSION}/quarto-${_QUARTO_VERSION}-linux-amd64.deb
RUN apt-get update > /dev/null && \
apt-get install /tmp/quarto.deb > /dev/null && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* && \
rm -f /tmp/quarto.deb

ENV SHINY_SERVER_URL=https://download3.rstudio.org/ubuntu-18.04/x86_64/shiny-server-1.5.21.1012-amd64.deb
ENV SHINY_SERVER_URL=https://download3.rstudio.org/ubuntu-18.04/x86_64/shiny-server-1.5.22.1017-amd64.deb
RUN curl --silent --location --fail ${SHINY_SERVER_URL} > /tmp/shiny-server.deb && \
apt install --no-install-recommends --yes /tmp/shiny-server.deb && \
rm /tmp/shiny-server.deb
Expand All @@ -66,18 +66,21 @@ RUN wget --quiet -O /tmp/chrome.deb https://dl.google.com/linux/direct/google-ch

RUN install -d -o ${NB_USER} -g ${NB_USER} ${CONDA_DIR}

# Install conda environment as our user
USER ${NB_USER}
COPY install-mambaforge.bash /tmp/install-mambaforge.bash
RUN /tmp/install-mambaforge.bash
COPY --chown=1000:1000 install-miniforge.bash /tmp/install-miniforge.bash
RUN /tmp/install-miniforge.bash
RUN rm -f /tmp/install-miniforge.bash

USER root
RUN rm -rf ${HOME}/.cache

USER ${NB_USER}
COPY environment.yml /tmp/environment.yml
COPY --chown=1000:1000 environment.yml /tmp/environment.yml

RUN mamba env update -p ${CONDA_DIR} -f /tmp/environment.yml && \
mamba clean -afy
RUN rm -f /tmp/environment.yml

# Prepare VS Code extensions
USER root
Expand All @@ -93,14 +96,14 @@ RUN ${CONDA_DIR}/bin/code-server --extensions-dir ${VSCODE_EXTENSIONS} --install
RUN ${CONDA_DIR}/bin/code-server --extensions-dir ${VSCODE_EXTENSIONS} --install-extension ms-python.python
RUN ${CONDA_DIR}/bin/code-server --extensions-dir ${VSCODE_EXTENSIONS} --install-extension quarto.quarto

# Install IRKernel
RUN R --quiet -e "install.packages('IRkernel', quiet = TRUE)" && \
R --quiet -e "IRkernel::installspec(prefix='${CONDA_DIR}')"
# Install R libraries as our user
USER ${NB_USER}

COPY class-libs.R /tmp/class-libs.R
COPY install-r-packages.r /tmp/
RUN Rscript /tmp/install-r-packages.r

COPY r-packages/2024-fall-stat-20.r /tmp/r-packages/
RUN r /tmp/r-packages/2024-fall-stat-20.r
# Install IRKernel kernel
RUN R --quiet -e "IRkernel::installspec(prefix='${CONDA_DIR}')"

# Configure locking behavior
COPY file-locks /etc/rstudio/file-locks
Expand Down
20 changes: 0 additions & 20 deletions class-libs.R

This file was deleted.

40 changes: 27 additions & 13 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,38 @@ channels:
dependencies:
# Matches version in images/hub/Dockerfile
- jupyterhub==4.1.6
- jupyterlab==4.2.5

- jupyterlab==4.3.4
- notebook==7.3.2
- ipykernel = 6.29.5
- ipywidgets==8.1.5
- nbgitpuller==1.2.1
- appmode==1.0.0
- jupyter-resource-usage==1.1.0
- jupyter-server-proxy==4.4.0
- jupyter-rsession-proxy==2.2.1
- jupyterlab-git==0.50.2
- python==3.12.*

# syncthing for dropbox-like functionality
- jupyter-syncthing-proxy==1.0.3

# jupyter archival tool for easy user downloads
- jupyter-archive==3.4.0
- jupyter-resource-usage==1.1.0

# vscode
- jupyter-vscode-proxy==0.6
- notebook==7.2.2
- nbconvert==7.6.0
- nbgitpuller==1.2.1
- ipywidgets==8.0.7
# bug w/notebook and traitlets: https://github.com/jupyter/notebook/issues/7048
#- traitlets=5.9.*
- matplotlib==3.8.3
- shiny==1.0.0
- appmode==1.0.0
- syncthing==1.22.2
- code-server==4.96.2

# jupyterbook
- mystmd==1.3.19

# gh-scoped-creds needs a newer version of git than what jammy provides
- gh-scoped-creds==4.1
- code-server==4.23.1
- git==2.47.0

- matplotlib=3.10.*
- shiny==1.2.1
- pip
- pip:
- git-credential-helpers==0.2
Expand All @@ -35,3 +48,4 @@ dependencies:
- jupyterlab-quarto==0.3.5
- nb2pdf==0.6.2
- nbpdfexport==0.2.1
- nbconvert[webpdf]
14 changes: 5 additions & 9 deletions install-mambaforge.bash → install-miniforge.bash
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
#!/bin/bash
# This downloads and installs a pinned version of mambaforge
# This downloads and installs a pinned version of miniforge
set -ex

cd $(dirname $0)
MAMBAFORGE_VERSION=24.9.2-0
MINIFORGE_VERSION='24.11.2-1'

URL="https://github.com/conda-forge/miniforge/releases/download/${MAMBAFORGE_VERSION}/Miniforge3-${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
URL="https://github.com/conda-forge/miniforge/releases/download/${MINIFORGE_VERSION}/Miniforge3-${MINIFORGE_VERSION}-Linux-x86_64.sh"
INSTALLER_PATH=/tmp/miniforge-installer.sh

export XDG_CACHE_HOME=$(mktemp)

Expand All @@ -28,7 +24,7 @@ conda config --system --set show_channel_urls true
# 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
echo > ${CONDA_DIR}/conda-meta/history

# Clean things out!
conda clean --all -f -y
Expand Down
66 changes: 66 additions & 0 deletions install-r-packages.r
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
#!/usr/bin/env Rscript

# Function to install R packages
install_packages_with_versions <- function(packages) {
available <- available.packages()
to_install <- names(packages)[!(names(packages) %in% rownames(installed.packages()))]

if (length(to_install) > 0) {
install.packages(to_install, available = available,
versions = packages[to_install],
dependencies = TRUE)
} else {
cat("All packages are already installed.\n")
}
}

# List of packages to ensure are installed
required_packages <- c("remotes", "devtools")

# Check and install required packages
new_packages <- required_packages[!sapply(required_packages, requireNamespace, quietly = TRUE)]
if (length(new_packages) > 0) {
install.packages(new_packages)
}


packages = list(
"fivethirtyeight" = "0.6.2",
"gapminder" = "1.0.0",
"janitor" = "2.2.1",
"openintro" = "2.5.0",
"pagedown" = "0.22",
"palmerpenguins" = "0.1.1",
"patchwork" = "1.3.0",
"showtext" = "0.9-7",
"swirl" = "2.4.5",
"tidycensus" = "1.6.7",
"tidymodels" = "1.2.0",
"tigris" = "2.1",
"unvotes" = "0.3.0",
"xaringanthemer" = "0.4.3",
"rmarkdown" = "2.29",
"plotly" = "4.10.4",
"reshape2" = "1.4.4",
"kableExtra" = "1.4.0",
"infer" = "1.0.7",
"countdown" = "0.4.0",
"ggrepel" = "0.9.6",
"ggthemes" = "5.1.0",
"latex2exp" = "0.9.6",
"markdown" = "1.13",
"downlit" = "0.4.4",
"xml2" = "1.3.6",
"gt" = "0.11.1",
"quarto" = "1.4.4",
"fs" = "1.6.5",
"rsample" = "1.2.1",
"IRkernel" = "1.3.2"
)

install_packages_with_versions(packages)

devtools::install_github("mdbeckman/dcData", ref="a900560")
devtools::install_github("hadley/emo@3f03b11")
devtools::install_github("andrewpbray/boxofdata@8afd934")
devtools::install_github("stat20/stat20data@2536a78")
48 changes: 0 additions & 48 deletions r-packages/2024-fall-stat-20.r

This file was deleted.

0 comments on commit 509d361

Please sign in to comment.