Skip to content

Commit

Permalink
images
Browse files Browse the repository at this point in the history
  • Loading branch information
cboettig committed Feb 4, 2024
1 parent 44f6c8d commit ed769b7
Show file tree
Hide file tree
Showing 7 changed files with 213 additions and 21 deletions.
47 changes: 47 additions & 0 deletions images/conda.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
## devcontainer-focused Rocker
FROM ghcr.io/rocker-org/devcontainer/tidyverse:4.3

## latest version of geospatial libs
RUN /rocker_scripts/experimental/install_dev_osgeo.sh
RUN apt-get update -qq && apt-get -y install vim

# podman doesn't not understand group permissions
RUN chown rstudio:staff -R ${R_HOME}/site-library

# some teaching preferences
RUN git config --system pull.rebase false && \
git config --system credential.helper 'cache --timeout=36000'

## codeserver
RUN curl -fsSL https://code-server.dev/install.sh | sh

# Set up conda
ENV NB_USER=rstudio
ENV CONDA_ENV=/opt/miniforge3
ENV PATH=${CONDA_ENV}/bin:${PATH}
RUN curl -L -O "https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-$(uname)-$(uname -m).sh" && \
bash Miniforge3-$(uname)-$(uname -m).sh -b -p ${CONDA_ENV} && \
chown ${NB_USER}:staff -R ${CONDA_ENV}


# Initialize conda by default for all users:
RUN conda init --system

## Openscapes-specific configs
USER ${NB_USER}
WORKDIR /home/${NB_USER}
RUN usermod -s /bin/bash ${NB_USER}

# install into the default environment
COPY install.R install.R
RUN Rscript install.R && rm install.R

# consider installing jupyter-like stuff into base env instead?
# Create a conda-based env and install into it without using conda init/conda activate
# (this yaml file doesn't include everything from pangeo, consider a different one...)
ENV MY_ENV=${CONDA_ENV}/envs/openscapes
COPY environment.yml environment.yml
RUN conda env create -p ${MY_ENV} -f environment.yml

ENV PATH=${MY_ENV}/bin:${PATH}

5 changes: 0 additions & 5 deletions images/conda_init.sh

This file was deleted.

87 changes: 87 additions & 0 deletions images/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: openscapes
channels:
- conda-forge
dependencies:
- python=3.10
- dask
- dask-gateway
- graphviz
- distributed
- rioxarray
- xarray>=2022.12
- h5netcdf
- netcdf4>=1.6.4
- h5py
- gdal~=3.8
- geoviews
- holoviews=1.16.2
- matplotlib-base
- seaborn
- intake
- hvplot
- datashader
- pyproj
- bqplot
- geopandas
- zarr
- cartopy
- pynco
- rasterio
- shapely
- pyresample
- icepyx
- joblib
- pystac-client
- pydap
- lxml
- ipyleaflet
# when jlab 4 gets released we can upgrade dask-labextension
# - dask-labextension
# - dask-labextension==6.2.0
- dask-labextension
- jupyter-server-proxy
- jupyter-vscode-proxy
- jupyter-rsession-proxy
- ipywidgets
- jupyter-book
- jupyterlab>4
- jupyterlab-myst
- jupyterhub-singleuser
- jupyterlab-geojson
- jupyterlab-favorites
- jupyterlab-git
- jupyter-resource-usage
- jupyterlab-h5web
- hdf5plugin
- ipympl
- conda-lock
- pooch
- earthaccess>=0.8.2
- sliderule>=3.6.0
# QGIS
- qgis~=3.28
- pyopencl
- ocl-icd-system
- websockify>=0.10
# /QGIS
- h5coro
- git >=2.39
- itslive
- rasterstats
- kerchunk
- rechunker
- pqdm
- spectral
- scikit-image
- coiled
- s3fs
- nbgitpuller
- awscliv2
- jupyter-server-proxy
- jupyter-vscode-proxy
# https://github.com/jupyterlab/jupyter-collaboration/issues/202
# - jupyter-collaboration
- code-server >=3.2
- pip
platforms:
- linux-64
11 changes: 6 additions & 5 deletions images/install.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@

# We could use renv.lock approach here instead, but will force re-creation of environment from scratch
# Does not provide a good way to ensure that sf/terra/gdalcubes are installed from source while other packages can be binary
install.packages("pak")
install.packages(c("rstac", "spData", "earthdatalogin", "quarto"))
pak::pkg_install('github::r-tmap/tmap')
# Likewise, pak insists on installing old gdal from apt instead of respecting system library source builds
# install.packages("pak")
install.packages(c("rstac", "spData", "earthdatalogin", "quarto", "aws.s3", "tmap"))
remotes::install_github('r-tmap/tmap')

#pak::pkg_install("httpgd")
pak::pkg_install(c("IRkernel", "languageserver"))
IRkernel::installspec()
#pak::pkg_install(c("IRkernel", "languageserver"))
#IRkernel::installspec()

17 changes: 6 additions & 11 deletions images/nasa-openscapes.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
## devcontainer-focused Rocker
FROM docker.io/rocker/binder:4.3

USER root
FROM ghcr.io/rocker-org/devcontainer/tidyverse:4.3

## latest version of geospatial libs
RUN /rocker_scripts/experimental/install_dev_osgeo.sh
RUN apt-get update -qq && apt-get -y install vim
RUN /rocker_scripts/install_jupyter.sh

# conda
ENV CONDA_ENV=/opt/miniforge3
Expand Down Expand Up @@ -40,22 +39,18 @@ ENV MY_ENV=${CONDA_ENV}/envs/openscapes
RUN wget https://github.com/NASA-Openscapes/corn/raw/main/ci/environment.yml && \
conda env create -p ${MY_ENV} -f environment.yml

# some teaching preferences
RUN git config --global pull.rebase false

# NOTES:
# conda (base) just means $CONDA_ENV/bin/
# conda (openscapes) means $MY_ENV, identically, $CONDA_ENV/envs/openscapes/bin/
# Rather than activate it or alter path, we just get it set up as an optional kernel
# We could easily make either the default by putting either bin path at the start of PATH

RUN ${MY_ENV}/bin/python -m pip install ipykernel && \
${MY_ENV}/bin/python -m ipykernel install --sys-prefix --name=openscapes
${MY_ENV}/bin/python -m ipykernel install --prefix /opt/venv --name=openscapes

ENV PATH=${MY_ENV}/bin:${PATH}

COPY conda_init.sh /etc/profile.d/conda_init.sh
RUN bash -c /etc/profile.d/conda_init.sh

# some teaching preferences
RUN git config --system pull.rebase false && \
git config --system credential.helper 'cache --timeout=36000'


31 changes: 31 additions & 0 deletions images/nasa-requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
jupyterhub
jupyterlab
notebook
jupyter-rsession-proxy
jupyter-console==6.6.3
jupyter-events==0.7.0
jupyter-lsp==2.2.0
jupyter_client==8.3.1
jupyter_core==5.3.2
jupyter_server==2.7.3
jupyter_server_terminals==0.4.4
jupyter-vscode-proxy==0.5
jupyterlab-pygments==0.2.2
jupyterlab-widgets==3.0.9
jupyterlab_server==2.25.0
nbconvert==7.8.0
nbformat==5.9.2
odc-stac==0.3.8
planetary-computer==1.0.0
polars
pyarrow
pystac-client==0.7.5
gh-scoped-creds
scikit-image
hvplot
geoviews
earthaccess
pyresample
contextily
pygeoweaver

36 changes: 36 additions & 0 deletions images/venv.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
## devcontainer-focused Rocker
FROM ghcr.io/rocker-org/devcontainer/tidyverse:4.3

## latest version of geospatial libs
RUN /rocker_scripts/experimental/install_dev_osgeo.sh
RUN apt-get update -qq && apt-get -y install vim

# standard python/jupyter setup
ENV NB_USER=rstudio
ENV VIRTUAL_ENV=/opt/venv
ENV PATH=${VIRTUAL_ENV}/bin:${PATH}
RUN /rocker_scripts/install_python.sh && \
chown ${NB_USER}:staff -R ${VIRTUAL_ENV}

# podman doesn't not understand group permissions
RUN chown ${NB_USER}:staff -R ${R_HOME}/site-library

# some teaching preferences
RUN git config --system pull.rebase false && \
git config --system credential.helper 'cache --timeout=36000'

## codeserver
RUN curl -fsSL https://code-server.dev/install.sh | sh

## Openscapes-specific configs
USER rstudio
WORKDIR /home/rstudio
RUN usermod -s /bin/bash rstudio

# install into the default environment
COPY requirements.txt requirements.txt
RUN python -m pip install -r requirements.txt && rm requirements.txt
COPY install.R install.R
RUN Rscript install.R && rm install.R


0 comments on commit ed769b7

Please sign in to comment.