generated from CU-ESIIL/Working_group_OASIS
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding docker workflow and gh pages docs
- Loading branch information
Erick Verleye
committed
Apr 23, 2024
1 parent
e9fd1d6
commit 7d4825e
Showing
22 changed files
with
542 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,44 @@ | ||
name: build-and-push-jupyterlab-image | ||
|
||
on: | ||
workflow_dispatch: # This allows you to manually trigger the action from GitHub UI. | ||
|
||
jobs: | ||
|
||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
|
||
- name: Checkout | ||
uses: actions/[email protected] | ||
|
||
- name: Set up Docker Buildx | ||
id: buildx | ||
uses: docker/[email protected] | ||
|
||
- name: Login to dockerhub | ||
uses: docker/[email protected] | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_PASSWORD }} | ||
|
||
- name: Get lowercase repo name (for dynamic tags) | ||
id: repo_name | ||
run: | | ||
lowercase_name=$(echo ${{ github.event.repository.name }} | tr '[:upper:]' '[:lower:]') | ||
echo "::set-output name=repo_name::${lowercase_name}" | ||
- name: Build and push latest | ||
id: docker_build_jupyterlab | ||
uses: docker/[email protected] | ||
with: | ||
context: docker/jupyterlab | ||
file: docker/jupyterlab/Dockerfile | ||
builder: ${{ steps.buildx.outputs.name }} | ||
push: true | ||
tags: | | ||
esiil/${{ steps.repo_name.outputs.repo_name }}_jupyterlab:latest | ||
- name: Image digest | ||
run: echo ${{ steps.docker_build.outputs.digest }} |
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,34 @@ | ||
name: Sync with Template Repository | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
sync_template: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout main repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Configure Git for merge | ||
run: | | ||
git config --global user.name "github-actions" | ||
git config --global user.email "[email protected]" | ||
- name: Fetch template repository | ||
run: git fetch --no-tags --no-recurse-submodules https://github.com/CU-ESIIL/Working_group_OASIS.git +refs/heads/*:refs/remotes/template/* | ||
|
||
- name: Merge changes from template repository | ||
run: | | ||
git merge --no-commit --no-ff --allow-unrelated-histories template/main || true | ||
git checkout --ours . | ||
git add . | ||
- name: Commit changes | ||
run: git commit -am "Merge changes from template repository" | ||
|
||
- name: Push changes | ||
uses: ad-m/github-push-action@master | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} |
Binary file not shown.
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,136 @@ | ||
FROM jupyter/r-notebook:hub-4.0.1 | ||
|
||
USER root | ||
|
||
# Set up package manager | ||
RUN apt-get install -y apt-transport-https && \ | ||
apt-get clean && apt-get update && apt-get install -y software-properties-common && \ | ||
add-apt-repository multiverse && \ | ||
apt-get clean && rm -rf /var/lib/apt/lists/* | ||
|
||
# Install some base software | ||
RUN apt-get update --yes && \ | ||
apt-get install --yes \ | ||
fonts-dejavu \ | ||
unixodbc \ | ||
unixodbc-dev \ | ||
r-base \ | ||
r-cran-rodbc && \ | ||
apt-get clean && rm -rf /var/lib/apt/lists/* | ||
|
||
# Add sudo to jovyan user | ||
RUN apt update && \ | ||
apt install -y sudo && \ | ||
apt clean && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
# This is where we can control which root permissions the jovyan user will have | ||
ARG PRIV_CMDS='/bin/ch*,/bin/cat,/bin/gunzip,/bin/tar,/bin/mkdir,/bin/ps,/bin/mv,/bin/cp,/usr/bin/apt*,/usr/bin/pip*,/bin/yum,/opt,/opt/conda/bin/*,/usr/bin/*' | ||
|
||
RUN usermod -aG sudo jovyan && \ | ||
echo "$LOCAL_USER ALL=NOPASSWD: $PRIV_CMDS" >> /etc/sudoers | ||
RUN addgroup jovyan | ||
RUN usermod -aG jovyan jovyan | ||
|
||
# Install RStudio | ||
RUN apt-get update && apt-get install --yes gdebi-core && \ | ||
wget https://download2.rstudio.org/server/jammy/amd64/rstudio-server-2023.09.1-494-amd64.deb && \ | ||
gdebi -n rstudio-server-2023.09.1-494-amd64.deb && \ | ||
rm rstudio-server-2023.09.1-494-amd64.deb && \ | ||
apt-get clean && rm -rf /var/lib/apt/lists/* | ||
|
||
# Install Geospatial libraries | ||
RUN apt-get update && \ | ||
apt install -y \ | ||
gdal-bin \ | ||
lbzip2 \ | ||
libfftw3-dev \ | ||
libgdal-dev \ | ||
libgeos-dev \ | ||
libgsl0-dev \ | ||
libgl1-mesa-dev \ | ||
libglu1-mesa-dev \ | ||
libhdf4-alt-dev \ | ||
libhdf5-dev \ | ||
libjq-dev \ | ||
libpq-dev \ | ||
libproj-dev \ | ||
libprotobuf-dev \ | ||
libnetcdf-dev \ | ||
libsqlite3-dev \ | ||
libudunits2-dev \ | ||
lsb-release \ | ||
netcdf-bin \ | ||
postgis \ | ||
protobuf-compiler \ | ||
sqlite3 \ | ||
tk-dev \ | ||
libfmt-dev \ | ||
unixodbc-dev && \ | ||
apt-get clean && rm -rf /var/lib/apt/lists/* | ||
|
||
# Fix RStudio / Conda openssl version mismatch | ||
RUN wget https://www.openssl.org/source/openssl-3.2.0.tar.gz && \ | ||
tar xfz openssl-3.2.0.tar.gz && \ | ||
mkdir openssl-build && cd openssl-build && \ | ||
../openssl-3.2.0/Configure --libdir=/lib/x86_64-linux-gnu/ && \ | ||
make && \ | ||
make install | ||
|
||
# Update permissions for /opt/conda | ||
RUN mkdir /usr/local/bin/start-notebook.d && \ | ||
chown -R jovyan:users /opt/conda/share /usr/local/share /usr/local/bin/start-notebook.d | ||
|
||
USER jovyan | ||
|
||
# Install jupyterlab and rstudio dependencies | ||
RUN conda install -c conda-forge \ | ||
jupyter_client \ | ||
jupyter_core \ | ||
jupyterlab_server \ | ||
jupyter_server \ | ||
r-rgl \ | ||
r-htmlwidgets \ | ||
r-htmltools && \ | ||
jupyter lab clean | ||
|
||
# reinstall R packages. Here is where you add any new R packages you would like to install | ||
RUN mamba install --quiet --yes \ | ||
r-base \ | ||
r-tidyverse \ | ||
r-terra \ | ||
r-future \ | ||
r-future.apply \ | ||
r-furrr \ | ||
&& \ | ||
mamba clean --all -f -y | ||
|
||
# Install Jupyter Lab Proxy extensions (cards in Launcher) | ||
RUN pip install jupyter-rsession-proxy jupyter-server-proxy jupyter-shiny-proxy jupyterlab-git | ||
|
||
# Install Mamba Gator package manager | ||
RUN rm -f ~/.jupyter/lab/workspaces/default* && \ | ||
mamba install -y -c conda-forge mamba_gator | ||
|
||
# Install and configure jupyter lab | ||
COPY jupyter_notebook_config.json /opt/conda/etc/jupyter/jupyter_notebook_config.json | ||
|
||
# Rebuild the Jupyter Lab with new tools | ||
RUN jupyter lab build | ||
|
||
# Build Conda environment. Any packages you would like to install with conda need to be added to the environment.yml file in this Dockerfiles directory | ||
RUN conda update -y conda && \ | ||
conda config --remove channels conda-forge && \ | ||
conda config --add channels conda-forge | ||
WORKDIR /home/jovyan | ||
COPY environment.yml /home/jovyan/ | ||
RUN mamba env create -f /home/jovyan/environment.yml | ||
RUN . /opt/conda/etc/profile.d/conda.sh && conda deactivate && conda activate custom && python -m ipykernel install --name custom && pip install jupyter_contrib_nbextensions | ||
|
||
# Install R packages from CRAN and GitHub | ||
RUN R -e "remotes::install_github('tomroh/ecoregions')" | ||
RUN R -e "install.packages('mblm', repos='http://cran.rstudio.com/')" | ||
|
||
# Set any required environment variables | ||
ENV PROJ_LIB=/opt/conda/envs/custom/share/proj | ||
RUN echo "PROJ_LIB=/opt/conda/envs/custom/share/proj" > /home/jovyan/.Renviron |
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,40 @@ | ||
name: custom | ||
channels: | ||
- conda-forge | ||
- defaults | ||
|
||
dependencies: | ||
- python=3.10 | ||
|
||
- pip: | ||
- affine==2.4.0 | ||
- aiosignal==1.3.1 | ||
- appdirs==1.4.4 | ||
- attrs==23.1.0 | ||
- certifi==2023.7.22 | ||
- charset-normalizer==3.1.0 | ||
- click==8.1.3 | ||
- click-plugins==1.1.1 | ||
- cligj==0.7.2 | ||
|
||
# Core scientific python | ||
- numpy | ||
- matplotlib | ||
- rioxarray | ||
- geopandas | ||
- gdal | ||
|
||
# Jupyter Lab Environment & Kernel | ||
- papermill | ||
- autopep8 | ||
- jupyterlab | ||
- notebook | ||
- ipython | ||
- nbclean | ||
- nbresuse | ||
- jupyterlab-geojson | ||
- nb_conda_kernels | ||
- ipykernel | ||
|
||
# openssh because openssl bin path is in conda now for Rstudio issue | ||
- openssh |
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,11 @@ | ||
{ | ||
"NotebookApp": { | ||
"allow_origin" : "*", | ||
"token":"", | ||
"password":"", | ||
"nbserver_extensions": { | ||
"jupyterlab": true, | ||
"mamba_gator": true | ||
} | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.