-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from EarthScope/test-nb
add hub image
- Loading branch information
Showing
3 changed files
with
91 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,68 @@ | ||
FROM ghcr.io/earthscope/strain-processing-notebooks | ||
|
||
#from https://github.com/2i2c-org/coessing-image/blob/main/Dockerfile | ||
USER root | ||
#ENV DEBIAN_FRONTEND=noninteractive | ||
#ENV PATH ${NB_PYTHON_PREFIX}/bin:$PATH | ||
|
||
#https://github.com/pangeo-data/pangeo-docker-images/blob/master/base-image/Dockerfile | ||
# Setup environment to match variables set by repo2docker as much as possible | ||
# The name of the conda environment into which the requested packages are installed | ||
ENV CONDA_ENV=notebook \ | ||
# Tell apt-get to not block installs by asking for interactive human input | ||
DEBIAN_FRONTEND=noninteractive \ | ||
# Set username, uid and gid (same as uid) of non-root user the container will be run as | ||
NB_USER=jovyan \ | ||
NB_UID=1000 \ | ||
# Use /bin/bash as shell, not the default /bin/sh (arrow keys, etc don't work then) | ||
SHELL=/bin/bash \ | ||
# Setup locale to be UTF-8, avoiding gnarly hard to debug encoding errors | ||
LANG=C.UTF-8 \ | ||
LC_ALL=C.UTF-8 \ | ||
# Install conda in the same place repo2docker does | ||
#CONDA_DIR=/srv/conda | ||
# Change to where docker stacks does https://github.com/EarthScope/strain-processing-notebooks/blob/aba9f9b5d2a199e75462c239ebf57a96dd33ffbf/docker-stacks-foundation/Dockerfile#L44C5-L44C25 | ||
CONDA_DIR=/opt/conda | ||
# All env vars that reference other env vars need to be in their own ENV block | ||
# Path to the python environment where the jupyter notebook packages are installed | ||
ENV NB_PYTHON_PREFIX=${CONDA_DIR}/envs/${CONDA_ENV} \ | ||
# Home directory of our non-root user | ||
HOME=/home/${NB_USER} | ||
|
||
# Add both our notebook env as well as default conda installation to $PATH | ||
# Thus, when we start a `python` process (for kernels, or notebooks, etc), | ||
# it loads the python in the notebook conda environment, as that comes | ||
# first here. | ||
ENV PATH=${NB_PYTHON_PREFIX}/bin:${CONDA_DIR}/bin:${PATH} | ||
|
||
# Ask dask to read config from ${CONDA_DIR}/etc rather than | ||
# the default of /etc, since the non-root jovyan user can write | ||
# to ${CONDA_DIR}/etc but not to /etc | ||
ENV DASK_ROOT_CONFIG=${CONDA_DIR}/etc | ||
|
||
# Run conda activate each time a bash shell starts, so users don't have to manually type conda activate | ||
# Note this is only read by shell, but not by the jupyter notebook - that relies | ||
# on us starting the correct `python` process, which we do by adding the notebook conda environment's | ||
# bin to PATH earlier ($NB_PYTHON_PREFIX/bin) | ||
RUN echo ". ${CONDA_DIR}/etc/profile.d/conda.sh ; conda activate ${CONDA_ENV}" > /etc/profile.d/init_conda.sh | ||
|
||
# Needed for apt-key to work | ||
RUN apt-get update -qq --yes > /dev/null && \ | ||
apt-get install --yes -qq gnupg2 > /dev/null | ||
|
||
USER ${NB_USER} | ||
|
||
COPY environment.yml /tmp/ | ||
|
||
RUN mamba env update --name ${CONDA_ENV} -f /tmp/environment.yml | ||
|
||
# Remove nb_conda_kernels from the env for now | ||
RUN mamba remove -n ${CONDA_ENV} nb_conda_kernels | ||
|
||
#COPY install-jupyter-extensions.bash /tmp/install-jupyter-extensions.bash | ||
#RUN /tmp/install-jupyter-extensions.bash | ||
|
||
# Set bash as shell in terminado. | ||
#ADD jupyter_notebook_config.py ${NB_PYTHON_PREFIX}/etc/jupyter/ | ||
# Disable history. | ||
#ADD ipython_config.py ${NB_PYTHON_PREFIX}/etc/ipython/ |
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,2 @@ | ||
docker build --rm -f Dockerfile -t ghcr.io/earthscope/strain-hub . | ||
docker push ghcr.io/earthscope/strain-hub |
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,21 @@ | ||
# This is the standard conda configuration file. Use this file to list | ||
# the conda packages that you need installed in your environment. | ||
channels: | ||
- conda-forge | ||
|
||
dependencies: | ||
- jupyter_contrib_nbextensions==0.5.1 | ||
# Required until https://github.com/jupyterhub/repo2docker/pull/1196 is merged | ||
- jupyterhub-singleuser>=3.0,<4.0 | ||
# Set default python version to 3.10 - repo2docker sets it to 3.7 instead by default, | ||
# which can limit us to older package versions | ||
- python=3.10 | ||
# extensions fail with notebook>7? https://stackoverflow.com/questions/76893872/modulenotfounderror-no-module-named-notebook-base-when-installing-nbextension | ||
- notebook==6.4.12 | ||
# Everyone wants to use nbgitpuller for everything, so let's do that | ||
- nbgitpuller=1.1.* | ||
# Add other packages here | ||
- nb_conda_kernels | ||
- pip | ||
- pip: | ||
- 'earthscopestraintools[mseed,tiledb]' |