Skip to content

Commit

Permalink
Merge pull request #11 from 2i2c-org/move-binder
Browse files Browse the repository at this point in the history
Switch base to rocker/binder image
  • Loading branch information
yuvipanda authored Nov 2, 2023
2 parents 8899e7b + dd5c5d6 commit bb58a48
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 66 deletions.
50 changes: 7 additions & 43 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,47 +1,13 @@
FROM rocker/geospatial:4.3.1
FROM rocker/binder:4.3.1

# Install conda here, to match what repo2docker does
ENV CONDA_DIR=/srv/conda
USER root

# Add our conda environment to PATH, so python, mamba and other tools are found in $PATH
ENV PATH ${CONDA_DIR}/bin:${PATH}
# Install python packages as root, since that's what is done upstream
# This may change soon https://github.com/rocker-org/rocker-versioned2/issues/670
COPY requirements.txt /tmp/requirements.txt
RUN pip install --no-cache -r /tmp/requirements.txt

# RStudio doesn't actually inherit the ENV set in Dockerfiles, so we
# have to explicitly set it in Renviron.site
RUN echo "PATH=${PATH}" >> /usr/local/lib/R/etc/Renviron.site

# The terminal inside RStudio doesn't read from Renviron.site, but does read
# from /etc/profile - so we rexport here.
RUN echo "export PATH=${PATH}" >> /etc/profile

# Install shiny-server
RUN /rocker_scripts/install_shiny_server.sh

# Install a specific version of mambaforge in ${CONDA_DIR}
# Pick latest version from https://github.com/conda-forge/miniforge/releases
ENV MAMBAFORGE_VERSION=22.9.0-2
RUN echo "Installing Mambaforge..." \
&& curl -sSL "https://github.com/conda-forge/miniforge/releases/download/${MAMBAFORGE_VERSION}/Mambaforge-${MAMBAFORGE_VERSION}-Linux-$(uname -m).sh" > installer.sh \
&& /bin/bash installer.sh -u -b -p ${CONDA_DIR} \
&& rm installer.sh \
&& mamba clean -afy \
# After installing the packages, we cleanup some unnecessary files
# to try reduce image size - see https://jcristharif.com/conda-docker-tips.html
&& find ${CONDA_DIR} -follow -type f -name '*.a' -delete \
&& find ${CONDA_DIR} -follow -type f -name '*.pyc' -delete

COPY environment.yml /tmp/environment.yml

RUN mamba env update -p ${CONDA_DIR} -f /tmp/environment.yml \
&& mamba clean -afy \
&& find ${CONDA_DIR} -follow -type f -name '*.a' -delete \
&& find ${CONDA_DIR} -follow -type f -name '*.pyc' -delete

# Install IRKernel
RUN install2.r --skipinstalled \
IRkernel \
rstan \
&& rm -rf /tmp/downloaded_packages
USER ${NB_USER}

# Install learnr and other requested packages in https://2i2c.freshdesk.com/a/tickets/741
# mosaic installed per https://2i2c.freshdesk.com/a/tickets/973
Expand All @@ -64,8 +30,6 @@ RUN install2.r --skipinstalled \
mosaic \
&& rm -rf /tmp/downloaded_packages

RUN r -e "IRkernel::installspec(prefix='${CONDA_DIR}')"

# Set working directory so Jupyter knows where to start
WORKDIR /home/rstudio

Expand Down
23 changes: 0 additions & 23 deletions environment.yml

This file was deleted.

9 changes: 9 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
retrolab
# Provide info on memory usage in JupyterLab & RetroLab
jupyter-resource-usage
# People still wanna pull stuff, even if into RStudio
nbgitpuller==1.2.0

jupyter-shiny-proxy==1.1
# Based on request from Nathan Taback
otter-grader==4.3.4

0 comments on commit bb58a48

Please sign in to comment.