Skip to content

Commit

Permalink
Use pangeo/pangeo-notebook as base image
Browse files Browse the repository at this point in the history
Curated upstream image! But it doesn't have R, so we
add it. Our environment.yml file only adds packages that
aren't in the base image.

Ref #3
  • Loading branch information
yuvipanda committed Nov 12, 2020
1 parent a4896e5 commit f070c29
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 93 deletions.
54 changes: 5 additions & 49 deletions deployments/ohw/image/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,62 +1,21 @@
FROM buildpack-deps:focal-scm
FROM pangeo/pangeo-notebook:6b2df38

ENV LC_ALL en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US.UTF-8
USER root
ENV DEBIAN_FRONTEND=noninteractive
ENV NB_USER jovyan
ENV NB_UID 1000

ENV CONDA_DIR /opt/conda
ENV R_LIBS_USER /opt/r

ENV PATH ${CONDA_DIR}/bin:$PATH

RUN adduser --disabled-password --gecos "Default Jupyter user" ${NB_USER}
#
# Create user owned R libs dir
# This lets users temporarily install packages
RUN mkdir -p ${R_LIBS_USER} && chown ${NB_USER}:${NB_USER} ${R_LIBS_USER}

# Install these without 'recommended' packages to keep image smaller.
# Useful utils that folks sort of take for granted
RUN apt-get update -qq --yes && \
apt-get install --yes --no-install-recommends -qq \
htop \
less \
man \
nano \
screen \
tar \
tmux \
wget \
vim \
locales > /dev/null

RUN echo "${LC_ALL} UTF-8" > /etc/locale.gen && \
locale-gen

# for nbconvert & notebook-to-pdf
RUN apt-get update -qq --yes && \
apt-get install --yes -qq \
pandoc \
texlive-xetex \
texlive-fonts-recommended \
> /dev/null

WORKDIR /home/jovyan

COPY install-miniforge.bash /tmp/install-miniforge.bash
RUN /tmp/install-miniforge.bash

# Install R packages
RUN apt-get update -qq --yes > /dev/null && \
apt-get install --yes -qq \
curl \
r-base \
r-base-dev \
r-recommended \
r-cran-littler > /dev/null
#
r-cran-littler

# Needed by many R libraries
# Picked up from https://github.com/rocker-org/rocker/blob/9dc3e458d4e92a8f41ccd75687cd7e316e657cc0/r-rspm/focal/Dockerfile
# Our pre-built R packages from rspm are built against system libs in focal
Expand Down Expand Up @@ -104,9 +63,6 @@ COPY rsession.conf /etc/rstudio/rsession.conf

USER ${NB_USER}

# FIXME: Split this into two files
# We can then install things that require python / jupyter separate
# from scientific python libs - speeding up image build times a lot
COPY environment.yml /tmp/

RUN conda env update -p ${CONDA_DIR} -f /tmp/environment.yml
Expand Down
46 changes: 3 additions & 43 deletions deployments/ohw/image/environment.yml
Original file line number Diff line number Diff line change
@@ -1,73 +1,33 @@
# Environment we need *on top* of base PANGEO stack
# Get list of pangeo packages from https://github.com/pangeo-data/pangeo-docker-images/blob/master/pangeo-notebook/packages.txt
# BUT REMEMBER TO PICK THE HASH THAT CORRESPONDS TO OUR BASE IMAGE
channels:
- conda-forge

dependencies:
# language runtimes
- python=3.8.*
- nodejs=14.8.*

- beautifulsoup4
- boto3
- botocore
- bottleneck
- cartopy
- cdsapi
- cmip6_preprocessing
- esmf
- ffmpeg
- fsspec
- gcsfs
- h5py
- iris
- lxml
- matplotlib
- metpy
- netcdf4
- numpy
# - opendrift
- pandas
- pvlib-python
- s3fs
- satpy
- scikit-learn
- scipy
- seaborn
- seawater
- siphon
- pytables
- xarray
- xesmf
- zarr
- geopandas
- descartes
- rioxarray
- nc-time-axis
# Let's make sure that dask-versions match between here & dask gateway
- dask==2.27.0
- distributed==2.27.0
- dask-gateway==0.8.0
- dask-kubernetes==0.10.1

- pip

- pip:
# Infrastructure things
- jupyterlab==2.*
- voila==0.1.23
- nbgitpuller==0.9.*
- nbresuse==0.3.6
- nbinteract==0.2.5
- jupytext==1.6.*
- RISE==5.6.1
- jupyter_contrib_nbextensions==0.5.1
- jupyter-desktop-server==0.1.3
- notebook==6.1.4
- jupyterhub==1.1.0
- jupyter-server-proxy==1.5.0
- jupyter-rsession-proxy==1.2
- jupyter-tree-download==1.0.1
- ipywidgets==7.5.1
- dask-labextension==3.0.0

# Science things. Prefer conda for these if possible
- git+https://github.com/trondkr/xESMF.git@27952e1ab2f1b7b23c443953b9d1e079376efb08
Expand Down
2 changes: 1 addition & 1 deletion deployments/ohw/image/install-jupyter-extensions.bash
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/bash -l

jupyter labextension install --debug \
@jupyter-widgets/jupyterlab-manager@2 \
Expand Down

0 comments on commit f070c29

Please sign in to comment.