From e5b4b0ba59e744ccefd39f80bb2116db3c4d4c7f Mon Sep 17 00:00:00 2001 From: Eli Holmes Date: Tue, 4 Jun 2024 10:09:44 -0700 Subject: [PATCH] major clean-up * move the dev images into draft_images * create all the devcontainer files --- .devcontainer/README.md | 23 +++++++- .devcontainer/aomlomics-jh/devcontainer.json | 21 +++++++ .devcontainer/arcgis/devcontainer.json | 21 +++++++ .../cmip6-cookbook/devcontainer.json | 21 +++++++ .devcontainer/coastwatch/devcontainer.json | 21 +++++++ .../codespace/devcontainer_template.sh | 26 +++++++++ .devcontainer/codespace/make_devcontainers.sh | 15 +++++ .devcontainer/codespace/test.json | 21 +++++++ .devcontainer/codespace/test.sh | 8 +++ .devcontainer/echopype/devcontainer.json | 21 +++++++ .../jupyter-base-notebook/devcontainer.json | 21 +++++++ .devcontainer/py-geospatial/devcontainer.json | 21 +++++++ .../py-rocket-base/devcontainer.json | 46 ++++----------- .../py-rocket-geospatial/devcontainer.json | 43 ++++---------- .../devcontainer.json | 1 + .devcontainer/template_works/junk | 10 ++++ .devcontainer/test2/Dockerfile | 3 - .devcontainer/test2/devcontainer.json | 24 -------- .devcontainer/vast/devcontainer.json | 21 +++++++ .github/workflows/docker-image-arcgis.yml | 10 +++- .../workflows/docker-image-argis-pangeo.yml | 15 ++--- .../docker-image-jupyter-multiple-conda.yml | 2 +- .../docker-image-openscapes-rocker.yml | 9 +-- .../workflows/docker-image-py-rocket-carl.yml | 2 +- .github/workflows/docker-image-test.yml | 2 +- DEVELOPERS.md | 56 +++---------------- .../arcgis-pangeo/Dockerfile | 0 .../arcgis-pangeo/Dockerfile_xarray | 0 .../arcgis-pangeo/apt.txt | 0 .../arcgis-pangeo/environment.yml | 0 .../arcgis-pangeo/full_environment.yml | 0 .../arcgis-pangeo/really_full_environment.yml | 0 {images => draft_images}/arcgis-pangeo/start | 0 .../jupyter-multiple-conda/Dockerfile | 0 .../jupyter-multiple-conda/README.md | 0 .../jupyter-multiple-conda/env1.yml | 0 .../jupyter-multiple-conda/env2.yml | 0 .../jhub-environment.yml | 0 .../jupyter_notebook_config.py | 0 .../openscapes-rocker/Dockerfile | 0 .../openscapes-rocker/environment.yml | 0 .../openscapes-rocker/xenvironment.yml | 0 .../py-rocket-carl/Dockerfile | 0 .../py-rocket-carl/environment.yml | 0 .../py-rocket-carl/install.R | 0 .../py-rocket-carl/nasa-requirements.txt | 0 .../py-rocket-carl/venv.Dockerfile | 0 {images => draft_images}/test/Dockerfile | 0 48 files changed, 319 insertions(+), 165 deletions(-) create mode 100644 .devcontainer/aomlomics-jh/devcontainer.json create mode 100644 .devcontainer/arcgis/devcontainer.json create mode 100644 .devcontainer/cmip6-cookbook/devcontainer.json create mode 100644 .devcontainer/coastwatch/devcontainer.json create mode 100755 .devcontainer/codespace/devcontainer_template.sh create mode 100755 .devcontainer/codespace/make_devcontainers.sh create mode 100644 .devcontainer/codespace/test.json create mode 100755 .devcontainer/codespace/test.sh create mode 100644 .devcontainer/echopype/devcontainer.json create mode 100644 .devcontainer/jupyter-base-notebook/devcontainer.json create mode 100644 .devcontainer/py-geospatial/devcontainer.json rename .devcontainer/{test => template_works}/devcontainer.json (93%) create mode 100644 .devcontainer/template_works/junk delete mode 100644 .devcontainer/test2/Dockerfile delete mode 100644 .devcontainer/test2/devcontainer.json create mode 100644 .devcontainer/vast/devcontainer.json rename {images => draft_images}/arcgis-pangeo/Dockerfile (100%) rename {images => draft_images}/arcgis-pangeo/Dockerfile_xarray (100%) rename {images => draft_images}/arcgis-pangeo/apt.txt (100%) rename {images => draft_images}/arcgis-pangeo/environment.yml (100%) rename {images => draft_images}/arcgis-pangeo/full_environment.yml (100%) rename {images => draft_images}/arcgis-pangeo/really_full_environment.yml (100%) rename {images => draft_images}/arcgis-pangeo/start (100%) rename {images => draft_images}/jupyter-multiple-conda/Dockerfile (100%) rename {images => draft_images}/jupyter-multiple-conda/README.md (100%) rename {images => draft_images}/jupyter-multiple-conda/env1.yml (100%) rename {images => draft_images}/jupyter-multiple-conda/env2.yml (100%) rename {images => draft_images}/jupyter-multiple-conda/jhub-environment.yml (100%) rename {images => draft_images}/jupyter-multiple-conda/jupyter_notebook_config.py (100%) rename {images => draft_images}/openscapes-rocker/Dockerfile (100%) rename {images => draft_images}/openscapes-rocker/environment.yml (100%) rename {images => draft_images}/openscapes-rocker/xenvironment.yml (100%) rename {images => draft_images}/py-rocket-carl/Dockerfile (100%) rename {images => draft_images}/py-rocket-carl/environment.yml (100%) rename {images => draft_images}/py-rocket-carl/install.R (100%) rename {images => draft_images}/py-rocket-carl/nasa-requirements.txt (100%) rename {images => draft_images}/py-rocket-carl/venv.Dockerfile (100%) rename {images => draft_images}/test/Dockerfile (100%) diff --git a/.devcontainer/README.md b/.devcontainer/README.md index 432bf07..0a9034d 100644 --- a/.devcontainer/README.md +++ b/.devcontainer/README.md @@ -2,5 +2,24 @@ Some notes regarding working with the nmfs-opensci jupyter lab images in codespa Many of these images include the RStudio server and jupyter-rsession-proxy. There are a number of oddies that occur when launching the RStudio server (via the button in JupyterLab) -* When a Dockerfile and `"build":` or docker compose is used, the PWD is changed to `/workspaces/` in the terminal tab of RStudio. If the image is used as-is with `"image": ` in the devcontainer.json file, this does not happen. -* In the images, port 8888 is exposed. If `jupyter lab --ip=0.0.0.0 --port=8888 --allow-root --no-browser` is used to start Jupyter Lab, then RStudio will not launch. There is some weird re-directing of the url. Instead use \ No newline at end of file +* In RStudio, the PWD is changed to `/workspaces/` in the terminal tab of RStudio. If the image is used as-is with `"image": ` in the devcontainer.json file, this does not happen. https://github.com/jupyterhub/jupyter-rsession-proxy/issues/145. This terminal is opened with `bash --login` so this tells it to use the right PWD `echo PWD=/home/jovyan\ncd $PWD >> ~/.bash_login` +* In the images, port 8888 is exposed. If `jupyter lab --ip=0.0.0.0 --port=8888 --allow-root --no-browser` is used to start Jupyter Lab, then RStudio will not launch. There is some weird re-directing of the url. Instead use a different port. I use 8889 + +Other oddities. + +* Rebuilding the devcontainer from a running devcontainer doesn't work because because the working directory is /home/jovyan and that does not have a devcontainer.json file. +* If a README.md file is in the working directory (set to /home/jovyan), then that is displayed automatically with preview. If a README.md file is created and opened with +``` + "customizations": { + "codespaces": { + "openFiles": [ "README.md" ], + }, + "vscode": { + "settings": { + "workbench.editorAssociations": { "*.md": "vscode.markdown.preview.editor", }, + }, + } + }, +``` +it will open in the editor not preview. My solution is to create a README.md in \home\jovyan after the container is started. + diff --git a/.devcontainer/aomlomics-jh/devcontainer.json b/.devcontainer/aomlomics-jh/devcontainer.json new file mode 100644 index 0000000..20ec9a5 --- /dev/null +++ b/.devcontainer/aomlomics-jh/devcontainer.json @@ -0,0 +1,21 @@ +{ + "name": "aomlomics-jh", + "workspaceFolder": "/home/jovyan", + "image": "ghcr.io/nmfs-opensci/container-images/aomlomics-jh:latest", + + // Ports to be forwarded from the container to the host + "forwardPorts": [8889], + "portsAttributes": { + "8889": { + "label": "Jupyter Lab", + "onAutoForward": "notify" + } + }, + + // Create a README that is automatically opened in preview mode + // the echo bit is to fix pwd in bash terminal in RStudio + "postCreateCommand": "echo '[![](https://img.shields.io/badge/Open%20Jupyter%20Lab-37a779?style=for-the-badge)](https://''-8889.app.github.dev)' > README.md && echo PWD=/home/jovyan\ncd /Users/eli.holmes/Documents/GitHub/container-images >> ~/.bash_login", + + // Start Jupyter Lab + "postStartCommand": "jupyter lab --ip=0.0.0.0 --port=8889 --allow-root --no-browser --notebook-dir=/home/jovyan --NotebookApp.token='' --NotebookApp.password=''", +} diff --git a/.devcontainer/arcgis/devcontainer.json b/.devcontainer/arcgis/devcontainer.json new file mode 100644 index 0000000..bfd9b4d --- /dev/null +++ b/.devcontainer/arcgis/devcontainer.json @@ -0,0 +1,21 @@ +{ + "name": "arcgis", + "workspaceFolder": "/home/jovyan", + "image": "ghcr.io/nmfs-opensci/container-images/arcgis:latest", + + // Ports to be forwarded from the container to the host + "forwardPorts": [8889], + "portsAttributes": { + "8889": { + "label": "Jupyter Lab", + "onAutoForward": "notify" + } + }, + + // Create a README that is automatically opened in preview mode + // the echo bit is to fix pwd in bash terminal in RStudio + "postCreateCommand": "echo '[![](https://img.shields.io/badge/Open%20Jupyter%20Lab-37a779?style=for-the-badge)](https://''-8889.app.github.dev)' > README.md && echo PWD=/home/jovyan\ncd /Users/eli.holmes/Documents/GitHub/container-images >> ~/.bash_login", + + // Start Jupyter Lab + "postStartCommand": "jupyter lab --ip=0.0.0.0 --port=8889 --allow-root --no-browser --notebook-dir=/home/jovyan --NotebookApp.token='' --NotebookApp.password=''", +} diff --git a/.devcontainer/cmip6-cookbook/devcontainer.json b/.devcontainer/cmip6-cookbook/devcontainer.json new file mode 100644 index 0000000..da2e3d5 --- /dev/null +++ b/.devcontainer/cmip6-cookbook/devcontainer.json @@ -0,0 +1,21 @@ +{ + "name": "cmip6-cookbook", + "workspaceFolder": "/home/jovyan", + "image": "ghcr.io/nmfs-opensci/container-images/cmip6-cookbook:latest", + + // Ports to be forwarded from the container to the host + "forwardPorts": [8889], + "portsAttributes": { + "8889": { + "label": "Jupyter Lab", + "onAutoForward": "notify" + } + }, + + // Create a README that is automatically opened in preview mode + // the echo bit is to fix pwd in bash terminal in RStudio + "postCreateCommand": "echo '[![](https://img.shields.io/badge/Open%20Jupyter%20Lab-37a779?style=for-the-badge)](https://''-8889.app.github.dev)' > README.md && echo PWD=/home/jovyan\ncd /Users/eli.holmes/Documents/GitHub/container-images >> ~/.bash_login", + + // Start Jupyter Lab + "postStartCommand": "jupyter lab --ip=0.0.0.0 --port=8889 --allow-root --no-browser --notebook-dir=/home/jovyan --NotebookApp.token='' --NotebookApp.password=''", +} diff --git a/.devcontainer/coastwatch/devcontainer.json b/.devcontainer/coastwatch/devcontainer.json new file mode 100644 index 0000000..e09a30c --- /dev/null +++ b/.devcontainer/coastwatch/devcontainer.json @@ -0,0 +1,21 @@ +{ + "name": "coastwatch", + "workspaceFolder": "/home/jovyan", + "image": "ghcr.io/nmfs-opensci/container-images/coastwatch:latest", + + // Ports to be forwarded from the container to the host + "forwardPorts": [8889], + "portsAttributes": { + "8889": { + "label": "Jupyter Lab", + "onAutoForward": "notify" + } + }, + + // Create a README that is automatically opened in preview mode + // the echo bit is to fix pwd in bash terminal in RStudio + "postCreateCommand": "echo '[![](https://img.shields.io/badge/Open%20Jupyter%20Lab-37a779?style=for-the-badge)](https://''-8889.app.github.dev)' > README.md && echo PWD=/home/jovyan\ncd /Users/eli.holmes/Documents/GitHub/container-images >> ~/.bash_login", + + // Start Jupyter Lab + "postStartCommand": "jupyter lab --ip=0.0.0.0 --port=8889 --allow-root --no-browser --notebook-dir=/home/jovyan --NotebookApp.token='' --NotebookApp.password=''", +} diff --git a/.devcontainer/codespace/devcontainer_template.sh b/.devcontainer/codespace/devcontainer_template.sh new file mode 100755 index 0000000..9a1c8ad --- /dev/null +++ b/.devcontainer/codespace/devcontainer_template.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +# Construct the message +message="{ + \"name\": \"$1\", + \"workspaceFolder\": \"/home/jovyan\", + \"image\": \"ghcr.io/nmfs-opensci/container-images/$1:latest\", + + // Ports to be forwarded from the container to the host + \"forwardPorts\": [8889], + \"portsAttributes\": { + \"8889\": { + \"label\": \"Jupyter Lab\", + \"onAutoForward\": \"notify\" + } + }, + + // Create a README that is automatically opened in preview mode + // the echo bit is to fix pwd in bash terminal in RStudio + \"postCreateCommand\": \"echo '[![](https://img.shields.io/badge/Open%20Jupyter%20Lab-37a779?style=for-the-badge)](https://'${CODESPACE_NAME}'-8889.app.github.dev)' > README.md && echo PWD=/home/jovyan\ncd $PWD >> ~/.bash_login\", + + // Start Jupyter Lab + \"postStartCommand\": \"jupyter lab --ip=0.0.0.0 --port=8889 --allow-root --no-browser --notebook-dir=/home/jovyan --NotebookApp.token='' --NotebookApp.password=''\", +}" + +echo "$message" > ./.devcontainer/$1/devcontainer.json \ No newline at end of file diff --git a/.devcontainer/codespace/make_devcontainers.sh b/.devcontainer/codespace/make_devcontainers.sh new file mode 100755 index 0000000..cfe6c96 --- /dev/null +++ b/.devcontainer/codespace/make_devcontainers.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +# cd .devcontainer/codespace +# chmod +x ./make_devcontainers.sh +# ./.devcontainer/codespace/make_devcontainers.sh +a=$(Rscript -e 'cat(here::here())') +cd $a +chmod +x ./.devcontainer/codespace/devcontainer_template.sh +fils="$(ls ./images)" +for i in $fils +do + echo $i + mkdir ../$i + ./.devcontainer/codespace/devcontainer_template.sh $i +done \ No newline at end of file diff --git a/.devcontainer/codespace/test.json b/.devcontainer/codespace/test.json new file mode 100644 index 0000000..b000208 --- /dev/null +++ b/.devcontainer/codespace/test.json @@ -0,0 +1,21 @@ +{ + "name": "vast", + "workspaceFolder": "/home/jovyan", + "image": "ghcr.io/nmfs-opensci/container-images/vast:latest", + + // Ports to be forwarded from the container to the host + "forwardPorts": [8889], + "portsAttributes": { + "8889": { + "label": "Jupyter Lab", + "onAutoForward": "notify" + } + }, + + // Create a README that is automatically opened in preview mode + // the echo bit is to fix pwd in bash terminal in RStudio + "postCreateCommand": "echo '[![](https://img.shields.io/badge/Open%20Jupyter%20Lab-37a779?style=for-the-badge)](https://''-8889.app.github.dev)' > README.md && echo PWD=/home/jovyan\ncd /Users/eli.holmes/Documents/GitHub/container-images/.devcontainer/codespace >> ~/.bash_login", + + // Start Jupyter Lab + "postStartCommand": "jupyter lab --ip=0.0.0.0 --port=8889 --allow-root --no-browser --notebook-dir=/home/jovyan --NotebookApp.token='' --NotebookApp.password=''", +} diff --git a/.devcontainer/codespace/test.sh b/.devcontainer/codespace/test.sh new file mode 100755 index 0000000..6f40239 --- /dev/null +++ b/.devcontainer/codespace/test.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +# Construct the message +message="{ + \"name\": $1, + \"workspaceFolder\": \"/home/jovyan\", + \"image\": \"ghcr.io/nmfs-opensci/container-images/\"$1\":latest\", +" \ No newline at end of file diff --git a/.devcontainer/echopype/devcontainer.json b/.devcontainer/echopype/devcontainer.json new file mode 100644 index 0000000..eea4a78 --- /dev/null +++ b/.devcontainer/echopype/devcontainer.json @@ -0,0 +1,21 @@ +{ + "name": "echopype", + "workspaceFolder": "/home/jovyan", + "image": "ghcr.io/nmfs-opensci/container-images/echopype:latest", + + // Ports to be forwarded from the container to the host + "forwardPorts": [8889], + "portsAttributes": { + "8889": { + "label": "Jupyter Lab", + "onAutoForward": "notify" + } + }, + + // Create a README that is automatically opened in preview mode + // the echo bit is to fix pwd in bash terminal in RStudio + "postCreateCommand": "echo '[![](https://img.shields.io/badge/Open%20Jupyter%20Lab-37a779?style=for-the-badge)](https://''-8889.app.github.dev)' > README.md && echo PWD=/home/jovyan\ncd /Users/eli.holmes/Documents/GitHub/container-images >> ~/.bash_login", + + // Start Jupyter Lab + "postStartCommand": "jupyter lab --ip=0.0.0.0 --port=8889 --allow-root --no-browser --notebook-dir=/home/jovyan --NotebookApp.token='' --NotebookApp.password=''", +} diff --git a/.devcontainer/jupyter-base-notebook/devcontainer.json b/.devcontainer/jupyter-base-notebook/devcontainer.json new file mode 100644 index 0000000..7f37149 --- /dev/null +++ b/.devcontainer/jupyter-base-notebook/devcontainer.json @@ -0,0 +1,21 @@ +{ + "name": "jupyter-base-notebook", + "workspaceFolder": "/home/jovyan", + "image": "ghcr.io/nmfs-opensci/container-images/jupyter-base-notebook:latest", + + // Ports to be forwarded from the container to the host + "forwardPorts": [8889], + "portsAttributes": { + "8889": { + "label": "Jupyter Lab", + "onAutoForward": "notify" + } + }, + + // Create a README that is automatically opened in preview mode + // the echo bit is to fix pwd in bash terminal in RStudio + "postCreateCommand": "echo '[![](https://img.shields.io/badge/Open%20Jupyter%20Lab-37a779?style=for-the-badge)](https://''-8889.app.github.dev)' > README.md && echo PWD=/home/jovyan\ncd /Users/eli.holmes/Documents/GitHub/container-images >> ~/.bash_login", + + // Start Jupyter Lab + "postStartCommand": "jupyter lab --ip=0.0.0.0 --port=8889 --allow-root --no-browser --notebook-dir=/home/jovyan --NotebookApp.token='' --NotebookApp.password=''", +} diff --git a/.devcontainer/py-geospatial/devcontainer.json b/.devcontainer/py-geospatial/devcontainer.json new file mode 100644 index 0000000..1a23372 --- /dev/null +++ b/.devcontainer/py-geospatial/devcontainer.json @@ -0,0 +1,21 @@ +{ + "name": "py-geospatial", + "workspaceFolder": "/home/jovyan", + "image": "ghcr.io/nmfs-opensci/container-images/py-geospatial:latest", + + // Ports to be forwarded from the container to the host + "forwardPorts": [8889], + "portsAttributes": { + "8889": { + "label": "Jupyter Lab", + "onAutoForward": "notify" + } + }, + + // Create a README that is automatically opened in preview mode + // the echo bit is to fix pwd in bash terminal in RStudio + "postCreateCommand": "echo '[![](https://img.shields.io/badge/Open%20Jupyter%20Lab-37a779?style=for-the-badge)](https://''-8889.app.github.dev)' > README.md && echo PWD=/home/jovyan\ncd /Users/eli.holmes/Documents/GitHub/container-images >> ~/.bash_login", + + // Start Jupyter Lab + "postStartCommand": "jupyter lab --ip=0.0.0.0 --port=8889 --allow-root --no-browser --notebook-dir=/home/jovyan --NotebookApp.token='' --NotebookApp.password=''", +} diff --git a/.devcontainer/py-rocket-base/devcontainer.json b/.devcontainer/py-rocket-base/devcontainer.json index 942b71b..9b7f6e6 100644 --- a/.devcontainer/py-rocket-base/devcontainer.json +++ b/.devcontainer/py-rocket-base/devcontainer.json @@ -1,47 +1,21 @@ { - // Name of the Dev Container - "name": "Py-Rocket Base Codespace", - - // Path to the Docker file + "name": "py-rocket-base", + "workspaceFolder": "/home/jovyan", "image": "ghcr.io/nmfs-opensci/container-images/py-rocket-base:latest", - // Mount a folder with the post_start.sh script to /home/jovyan/codespace - // Don't use /home/jovyan as that would wipe out files there - // We need post_start.sh in our container - "workspaceMount": "source=${localWorkspaceFolder}/.devcontainer/codespace,target=/home/jovyan/codespace,type=bind,consistency=delegated", - - // Default workspace folder within the container - "workspaceFolder": "/home/jovyan/codespace", - - // Required for Jupyter Lab - "customizations": { - "vscode": { - "extensions": [ - "ms-toolsai.jupyter", - "ms-python.python", - ] - }, - }, - - // Settings for the VS Code - "settings": { - "terminal.integrated.shell.linux": "/bin/bash", - }, - // Ports to be forwarded from the container to the host "forwardPorts": [8889], - - // Attributes for the forwarded ports "portsAttributes": { "8889": { "label": "Jupyter Lab", - "onAutoForward": "openBrowser" + "onAutoForward": "notify" } }, - - // Command to run after the container starts. Runs script to add a link to the Jupyter Lab - "postStartCommand": "chmod +x /home/jovyan/codespace/post_start.sh && /home/jovyan/codespace/post_start.sh && rm /home/jovyan/codespace/post_start.sh && jupyter lab --ip=0.0.0.0 --port=8889 --allow-root --no-browser --NotebookApp.token='' --NotebookApp.password=''", - - // List of extensions to be installed - "extensions": [] + + // Create a README that is automatically opened in preview mode + // the echo bit is to fix pwd in bash terminal in RStudio + "postCreateCommand": "echo '[![](https://img.shields.io/badge/Open%20Jupyter%20Lab-37a779?style=for-the-badge)](https://''-8889.app.github.dev)' > README.md && echo PWD=/home/jovyan\ncd /Users/eli.holmes/Documents/GitHub/container-images >> ~/.bash_login", + + // Start Jupyter Lab + "postStartCommand": "jupyter lab --ip=0.0.0.0 --port=8889 --allow-root --no-browser --notebook-dir=/home/jovyan --NotebookApp.token='' --NotebookApp.password=''", } diff --git a/.devcontainer/py-rocket-geospatial/devcontainer.json b/.devcontainer/py-rocket-geospatial/devcontainer.json index 6324771..60d4f9d 100644 --- a/.devcontainer/py-rocket-geospatial/devcontainer.json +++ b/.devcontainer/py-rocket-geospatial/devcontainer.json @@ -1,44 +1,21 @@ { - // Name of the Dev Container - "name": "Py-Rocket Geospatial Codespace", - - // Path to the Docker file + "name": "py-rocket-geospatial", + "workspaceFolder": "/home/jovyan", "image": "ghcr.io/nmfs-opensci/container-images/py-rocket-geospatial:latest", - "workspaceMount": "source=${localWorkspaceFolder}/.devcontainer/codespace,target=/home/jovyan/codespace,type=bind,consistency=delegated", - - // Default workspace folder within the container - "workspaceFolder": "/home/jovyan/codespace", - - // Required for Jupyter Lab - "customizations": { - "vscode": { - "extensions": [ - "ms-toolsai.jupyter", - "ms-python.python", - ] - } - }, - - // Settings for the integrated terminal - "settings": { - "terminal.integrated.shell.linux": "/bin/bash" - }, - // Ports to be forwarded from the container to the host "forwardPorts": [8889], - - // Attributes for the forwarded ports "portsAttributes": { "8889": { "label": "Jupyter Lab", - "onAutoForward": "openPreview" + "onAutoForward": "notify" } }, - - // Command to run after the container starts. Runs script to add a link to the RStudio - "postStartCommand": "chmod +x /home/jovyan/codespace/post_start.sh && /home/jovyan/codespace/post_start.sh && rm /home/jovyan/codespace/post_start.sh", - - // List of extensions to be installed - "extensions": [] + + // Create a README that is automatically opened in preview mode + // the echo bit is to fix pwd in bash terminal in RStudio + "postCreateCommand": "echo '[![](https://img.shields.io/badge/Open%20Jupyter%20Lab-37a779?style=for-the-badge)](https://''-8889.app.github.dev)' > README.md && echo PWD=/home/jovyan\ncd /Users/eli.holmes/Documents/GitHub/container-images >> ~/.bash_login", + + // Start Jupyter Lab + "postStartCommand": "jupyter lab --ip=0.0.0.0 --port=8889 --allow-root --no-browser --notebook-dir=/home/jovyan --NotebookApp.token='' --NotebookApp.password=''", } diff --git a/.devcontainer/test/devcontainer.json b/.devcontainer/template_works/devcontainer.json similarity index 93% rename from .devcontainer/test/devcontainer.json rename to .devcontainer/template_works/devcontainer.json index 01bbbe3..14fa1b3 100644 --- a/.devcontainer/test/devcontainer.json +++ b/.devcontainer/template_works/devcontainer.json @@ -13,6 +13,7 @@ }, // Create a README that is automatically opened in preview mode + // the echo bit is to fix pwd in bash terminal in RStudio "postCreateCommand": "echo '[![](https://img.shields.io/badge/Open%20Jupyter%20Lab-37a779?style=for-the-badge)](https://'${CODESPACE_NAME}'-8889.app.github.dev)' > README.md && echo PWD=/home/jovyan\ncd $PWD >> ~/.bash_login", // Start Jupyter Lab diff --git a/.devcontainer/template_works/junk b/.devcontainer/template_works/junk new file mode 100644 index 0000000..81ed363 --- /dev/null +++ b/.devcontainer/template_works/junk @@ -0,0 +1,10 @@ + "customizations": { + "codespaces": { + "openFiles": [ "README.md" ], + }, + "vscode": { + "settings": { + "workbench.editorAssociations": { "*.md": "vscode.markdown.preview.editor", }, + }, + } + }, diff --git a/.devcontainer/test2/Dockerfile b/.devcontainer/test2/Dockerfile deleted file mode 100644 index a59d4e9..0000000 --- a/.devcontainer/test2/Dockerfile +++ /dev/null @@ -1,3 +0,0 @@ -FROM ghcr.io/nmfs-opensci/container-images/py-rocket-base:latest -RUN echo "/home/jovyan" > README.md -ENV PWD=/home/jovyan \ No newline at end of file diff --git a/.devcontainer/test2/devcontainer.json b/.devcontainer/test2/devcontainer.json deleted file mode 100644 index e6e3cc6..0000000 --- a/.devcontainer/test2/devcontainer.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - // Name of the Dev Container - "name": "test2", - - // Home dir - "workspaceFolder": "/home/jovyan", - - // Dockerfile - "build": { "dockerfile": "Dockerfile" }, - - // Ports to be forwarded from the container to the host - "forwardPorts": [8889], - - // Attributes for the forwarded ports - "portsAttributes": { - "8889": { - "label": "Jupyter Lab", - } - }, - - // Command to run after the container starts. Runs script to add a link to the Jupyter Lab - "postCreateCommand": "echo '[![](https://img.shields.io/badge/Open%20Jupyter%20Lab-37a779?style=for-the-badge)](https://'${CODESPACE_NAME}'-8889.app.github.dev)' > README.md", - "postStartCommand": "jupyter lab --ip=0.0.0.0 --port=8889 --allow-root --no-browser --NotebookApp.token='' --NotebookApp.password=''", -} diff --git a/.devcontainer/vast/devcontainer.json b/.devcontainer/vast/devcontainer.json new file mode 100644 index 0000000..367d8c3 --- /dev/null +++ b/.devcontainer/vast/devcontainer.json @@ -0,0 +1,21 @@ +{ + "name": "vast", + "workspaceFolder": "/home/jovyan", + "image": "ghcr.io/nmfs-opensci/container-images/vast:latest", + + // Ports to be forwarded from the container to the host + "forwardPorts": [8889], + "portsAttributes": { + "8889": { + "label": "Jupyter Lab", + "onAutoForward": "notify" + } + }, + + // Create a README that is automatically opened in preview mode + // the echo bit is to fix pwd in bash terminal in RStudio + "postCreateCommand": "echo '[![](https://img.shields.io/badge/Open%20Jupyter%20Lab-37a779?style=for-the-badge)](https://''-8889.app.github.dev)' > README.md && echo PWD=/home/jovyan\ncd /Users/eli.holmes/Documents/GitHub/container-images >> ~/.bash_login", + + // Start Jupyter Lab + "postStartCommand": "jupyter lab --ip=0.0.0.0 --port=8889 --allow-root --no-browser --notebook-dir=/home/jovyan --NotebookApp.token='' --NotebookApp.password=''", +} diff --git a/.github/workflows/docker-image-arcgis.yml b/.github/workflows/docker-image-arcgis.yml index e52576b..01e3644 100644 --- a/.github/workflows/docker-image-arcgis.yml +++ b/.github/workflows/docker-image-arcgis.yml @@ -1,10 +1,15 @@ name: Docker Image CI arcgis +env: + IMAGE_NAME: arcgis + IMAGE_TAG: 2024-06-04 + on: workflow_dispatch: null push: branches: main paths: - 'images/arcgis/**' + - '.github/workflows/docker-image-arcgis.yml' jobs: build: runs-on: ubuntu-latest @@ -21,9 +26,10 @@ jobs: - name: Build the Docker image if: github.repository == 'nmfs-opensci/container-images' run: | - docker build images/arcgis -f images/arcgis/Dockerfile --tag ghcr.io/nmfs-opensci/container-images/arcgis:latest + docker build images/$IMAGE_NAME -f images/$IMAGE_NAME/Dockerfile --tag ghcr.io/nmfs-opensci/container-images/$IMAGE_NAME:$IMAGE_TAG --tag ghcr.io/nmfs-opensci/container-images/$IMAGE_NAME:latest - name: Publish if: github.repository == 'nmfs-opensci/container-images' run: | - docker push ghcr.io/nmfs-opensci/container-images/arcgis:latest + docker push ghcr.io/nmfs-opensci/container-images/$IMAGE_NAME:$IMAGE_TAG + docker push ghcr.io/nmfs-opensci/container-images/$IMAGE_NAME:latest diff --git a/.github/workflows/docker-image-argis-pangeo.yml b/.github/workflows/docker-image-argis-pangeo.yml index 7f65618..3b10a64 100644 --- a/.github/workflows/docker-image-argis-pangeo.yml +++ b/.github/workflows/docker-image-argis-pangeo.yml @@ -1,17 +1,14 @@ -name: Docker Image CI argis pangeo -# To use this template, change the env variables -# IMAGE_NAME this should be the same name as the folder in which the Dockerfile is -# IMAGE_TAG whatever tag you want to automatically be used +name: Docker Image CI arcgis-pangeo env: IMAGE_NAME: arcgis-pangeo - IMAGE_TAG: latest - + IMAGE_TAG: 2024-06-04 + on: workflow_dispatch: null push: branches: main paths: - - 'images/arcgis-pangeo/**' + - 'draft_images/arcgis-pangeo/**' - '.github/workflows/docker-image-arcgis-pangeo.yml' jobs: build: @@ -29,9 +26,9 @@ jobs: - name: Build the Docker image if: github.repository == 'nmfs-opensci/container-images' run: | - docker build images/$IMAGE_NAME -f images/$IMAGE_NAME/Dockerfile --tag ghcr.io/nmfs-opensci/container-images/$IMAGE_NAME:$IMAGE_TAG + docker build images/$IMAGE_NAME -f images/$IMAGE_NAME/Dockerfile --tag ghcr.io/nmfs-opensci/container-images/$IMAGE_NAME:$IMAGE_TAG --tag ghcr.io/nmfs-opensci/container-images/$IMAGE_NAME:latest - name: Publish if: github.repository == 'nmfs-opensci/container-images' run: | docker push ghcr.io/nmfs-opensci/container-images/$IMAGE_NAME:$IMAGE_TAG - + docker push ghcr.io/nmfs-opensci/container-images/$IMAGE_NAME:latest diff --git a/.github/workflows/docker-image-jupyter-multiple-conda.yml b/.github/workflows/docker-image-jupyter-multiple-conda.yml index 026cb88..6369683 100644 --- a/.github/workflows/docker-image-jupyter-multiple-conda.yml +++ b/.github/workflows/docker-image-jupyter-multiple-conda.yml @@ -4,7 +4,7 @@ on: push: branches: main paths: - - 'images/jupyter-multiple-conda/**' + - 'draft_images/jupyter-multiple-conda/**' - '.github/workflows/docker-image-jupyter-multiple-conda.yml' jobs: build: diff --git a/.github/workflows/docker-image-openscapes-rocker.yml b/.github/workflows/docker-image-openscapes-rocker.yml index f12ea73..2478676 100644 --- a/.github/workflows/docker-image-openscapes-rocker.yml +++ b/.github/workflows/docker-image-openscapes-rocker.yml @@ -1,14 +1,14 @@ name: Docker Image CI openscapes-rocker env: IMAGE_NAME: openscapes-rocker - IMAGE_TAG: latest - + IMAGE_TAG: 2024-06-04 + on: workflow_dispatch: null push: branches: main paths: - - 'images/openscapes-rocker/**' + - 'draft_images/openscapes-rocker/**' - '.github/workflows/docker-image-openscapes-rocker.yml' jobs: build: @@ -26,9 +26,10 @@ jobs: - name: Build the Docker image if: github.repository == 'nmfs-opensci/container-images' run: | - docker build images/$IMAGE_NAME -f images/$IMAGE_NAME/Dockerfile --tag ghcr.io/nmfs-opensci/container-images/$IMAGE_NAME:$IMAGE_TAG + docker build images/$IMAGE_NAME -f images/$IMAGE_NAME/Dockerfile --tag ghcr.io/nmfs-opensci/container-images/$IMAGE_NAME:$IMAGE_TAG --tag ghcr.io/nmfs-opensci/container-images/$IMAGE_NAME:latest - name: Publish if: github.repository == 'nmfs-opensci/container-images' run: | docker push ghcr.io/nmfs-opensci/container-images/$IMAGE_NAME:$IMAGE_TAG + docker push ghcr.io/nmfs-opensci/container-images/$IMAGE_NAME:latest diff --git a/.github/workflows/docker-image-py-rocket-carl.yml b/.github/workflows/docker-image-py-rocket-carl.yml index bf54b29..e346799 100644 --- a/.github/workflows/docker-image-py-rocket-carl.yml +++ b/.github/workflows/docker-image-py-rocket-carl.yml @@ -8,7 +8,7 @@ on: push: branches: main paths: - - 'images/py-rocket-carl/**' + - 'draft_images/py-rocket-carl/**' - '.github/workflows/docker-image-py-rocket-carl.yml' jobs: build: diff --git a/.github/workflows/docker-image-test.yml b/.github/workflows/docker-image-test.yml index ac5c779..3dfaf01 100644 --- a/.github/workflows/docker-image-test.yml +++ b/.github/workflows/docker-image-test.yml @@ -12,7 +12,7 @@ on: push: branches: main paths: - - 'images/test/**' + - 'draft_images/test/**' - '.github/workflows/docker-image-test.yml' jobs: build: diff --git a/DEVELOPERS.md b/DEVELOPERS.md index fba0d27..0c71e02 100644 --- a/DEVELOPERS.md +++ b/DEVELOPERS.md @@ -14,7 +14,7 @@ These are the main base images. They are variants of the Openscapes images. See ## To add images to the repository -* Create new dir in `images` directory for your image. Add the Dockerfile there. +* Create new dir in `draft_images` directory for your image. Add the draft Dockerfile there. * Create new `build-docker-mynewimage.yml` file in `.github/workflows` folder and make necessary edits in the file. It'll be obvious. * Push the changes and the docker image should build. Check the Actions tab to check progress and debug fails. * Once the image builds, you'll see it listed under packages in the right nav bar. @@ -51,55 +51,13 @@ In the terminal look for something like and put that in a browser. http://127.0.0.1:8888/lab?token=6d45c7d88aba92a815647c ``` -## Run with Binder - -Should work out of the box. Copy the Dockerfile into a repo and put the Dockerfile in the base or in a folder called `binder`. Then put this in a browser. Note many of the Docker images are big and somewhat hairy to build. This might not work in binder. - -``` -https://mybinder.org/v2/gh/user-name/reponame/main -``` - -## With Codespaces - -Still working to streamline this. - -## GitPod -- like Codespaces - -Still working to streamline this. - -## Run on Colab? - -https://github.com/indigo-dc/udocker - -Installation in the Jupyter notebook -``` -%%shell -pip install udocker -udocker --allow-root install -udocker --allow-root run -p 127.0.0.1:8888:8888 -v -e ghcr.io/nmfs-opensci/container-images/openscapes-rocker:latest -``` - -Or this? https://stackoverflow.com/questions/62820498/how-to-connect-google-colab-with-localhost-running-docker-image - -port forwarding https://biplobsd.me/blogs/view/run-swirl-open-source-search-engine-on-google-colab.md - -## License information - -All code is under open licenses. Some is copy-left which means if you modify their code (we don't), you need to also provide your source code. The Dockerfile code is released under Apache 2.0, a very permissive open source license which does not require that you make you own modifications open. See the README.md files for the licenses for specific code used in the Docker files. - -* The Dockerfiles are released under Apache 2.0. -* [jupyterhub](https://github.com/jupyterhub/jupyterhub?tab=License-1-ov-file#readme) : Modified BSD License -* [juptyerlab](https://github.com/jupyterlab/jupyterlab?tab=License-1-ov-file#readme): Open license - -* [Openscapes base Python image](https://github.com/nasa-openscapes/corn): MIT -* [Pangeo Docker Stack](https://github.com/pangeo-data/pangeo-docker-images): MIT -* [Python](https://docs.python.org/3/license.html): Zero clause BSD - -* [Openscapes base rocker image](https://github.com/nasa-openscapes/py-rocket): MIT -* [Rocker Docker Stack](https://github.com/rocker-org/rocker-versioned2?tab=GPL-2.0-1-ov-file#readme): GPL-2 -* [R](https://www.r-project.org/Licenses/): GPL-2, GPL-3 -* RStudio Server: GPL-3 +## Creating the .devcontainer files +It is all in `.devcontainer/codespace`. You will run the `.make_devcontainers.sh` script. Instructions are in the script. +## Creating a .binder branch +Each image has to have its own branch since binder needs a repo. +* Create branch +* Edit the file in the `.binder` directory to have the right docker image \ No newline at end of file diff --git a/images/arcgis-pangeo/Dockerfile b/draft_images/arcgis-pangeo/Dockerfile similarity index 100% rename from images/arcgis-pangeo/Dockerfile rename to draft_images/arcgis-pangeo/Dockerfile diff --git a/images/arcgis-pangeo/Dockerfile_xarray b/draft_images/arcgis-pangeo/Dockerfile_xarray similarity index 100% rename from images/arcgis-pangeo/Dockerfile_xarray rename to draft_images/arcgis-pangeo/Dockerfile_xarray diff --git a/images/arcgis-pangeo/apt.txt b/draft_images/arcgis-pangeo/apt.txt similarity index 100% rename from images/arcgis-pangeo/apt.txt rename to draft_images/arcgis-pangeo/apt.txt diff --git a/images/arcgis-pangeo/environment.yml b/draft_images/arcgis-pangeo/environment.yml similarity index 100% rename from images/arcgis-pangeo/environment.yml rename to draft_images/arcgis-pangeo/environment.yml diff --git a/images/arcgis-pangeo/full_environment.yml b/draft_images/arcgis-pangeo/full_environment.yml similarity index 100% rename from images/arcgis-pangeo/full_environment.yml rename to draft_images/arcgis-pangeo/full_environment.yml diff --git a/images/arcgis-pangeo/really_full_environment.yml b/draft_images/arcgis-pangeo/really_full_environment.yml similarity index 100% rename from images/arcgis-pangeo/really_full_environment.yml rename to draft_images/arcgis-pangeo/really_full_environment.yml diff --git a/images/arcgis-pangeo/start b/draft_images/arcgis-pangeo/start similarity index 100% rename from images/arcgis-pangeo/start rename to draft_images/arcgis-pangeo/start diff --git a/images/jupyter-multiple-conda/Dockerfile b/draft_images/jupyter-multiple-conda/Dockerfile similarity index 100% rename from images/jupyter-multiple-conda/Dockerfile rename to draft_images/jupyter-multiple-conda/Dockerfile diff --git a/images/jupyter-multiple-conda/README.md b/draft_images/jupyter-multiple-conda/README.md similarity index 100% rename from images/jupyter-multiple-conda/README.md rename to draft_images/jupyter-multiple-conda/README.md diff --git a/images/jupyter-multiple-conda/env1.yml b/draft_images/jupyter-multiple-conda/env1.yml similarity index 100% rename from images/jupyter-multiple-conda/env1.yml rename to draft_images/jupyter-multiple-conda/env1.yml diff --git a/images/jupyter-multiple-conda/env2.yml b/draft_images/jupyter-multiple-conda/env2.yml similarity index 100% rename from images/jupyter-multiple-conda/env2.yml rename to draft_images/jupyter-multiple-conda/env2.yml diff --git a/images/jupyter-multiple-conda/jhub-environment.yml b/draft_images/jupyter-multiple-conda/jhub-environment.yml similarity index 100% rename from images/jupyter-multiple-conda/jhub-environment.yml rename to draft_images/jupyter-multiple-conda/jhub-environment.yml diff --git a/images/jupyter-multiple-conda/jupyter_notebook_config.py b/draft_images/jupyter-multiple-conda/jupyter_notebook_config.py similarity index 100% rename from images/jupyter-multiple-conda/jupyter_notebook_config.py rename to draft_images/jupyter-multiple-conda/jupyter_notebook_config.py diff --git a/images/openscapes-rocker/Dockerfile b/draft_images/openscapes-rocker/Dockerfile similarity index 100% rename from images/openscapes-rocker/Dockerfile rename to draft_images/openscapes-rocker/Dockerfile diff --git a/images/openscapes-rocker/environment.yml b/draft_images/openscapes-rocker/environment.yml similarity index 100% rename from images/openscapes-rocker/environment.yml rename to draft_images/openscapes-rocker/environment.yml diff --git a/images/openscapes-rocker/xenvironment.yml b/draft_images/openscapes-rocker/xenvironment.yml similarity index 100% rename from images/openscapes-rocker/xenvironment.yml rename to draft_images/openscapes-rocker/xenvironment.yml diff --git a/images/py-rocket-carl/Dockerfile b/draft_images/py-rocket-carl/Dockerfile similarity index 100% rename from images/py-rocket-carl/Dockerfile rename to draft_images/py-rocket-carl/Dockerfile diff --git a/images/py-rocket-carl/environment.yml b/draft_images/py-rocket-carl/environment.yml similarity index 100% rename from images/py-rocket-carl/environment.yml rename to draft_images/py-rocket-carl/environment.yml diff --git a/images/py-rocket-carl/install.R b/draft_images/py-rocket-carl/install.R similarity index 100% rename from images/py-rocket-carl/install.R rename to draft_images/py-rocket-carl/install.R diff --git a/images/py-rocket-carl/nasa-requirements.txt b/draft_images/py-rocket-carl/nasa-requirements.txt similarity index 100% rename from images/py-rocket-carl/nasa-requirements.txt rename to draft_images/py-rocket-carl/nasa-requirements.txt diff --git a/images/py-rocket-carl/venv.Dockerfile b/draft_images/py-rocket-carl/venv.Dockerfile similarity index 100% rename from images/py-rocket-carl/venv.Dockerfile rename to draft_images/py-rocket-carl/venv.Dockerfile diff --git a/images/test/Dockerfile b/draft_images/test/Dockerfile similarity index 100% rename from images/test/Dockerfile rename to draft_images/test/Dockerfile