Skip to content

Commit

Permalink
Merge pull request #216 from kabilar/docker-publish
Browse files Browse the repository at this point in the history
Fix GitHub Actions and add AllenSDK Dockerfiles
  • Loading branch information
kabilar authored Dec 20, 2024
2 parents 4681ea8 + 4c9d572 commit b085fbf
Show file tree
Hide file tree
Showing 10 changed files with 229 additions and 70 deletions.
23 changes: 12 additions & 11 deletions .github/workflows/docker-push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,16 @@ jobs:

strategy:
matrix:
image:
- name: base
include:
- tag: latest
dockerfile: Dockerfile
- name: matlab
dockerfile: Dockerfile.matlab
- name: gpu
- tag: latest-allensdk
dockerfile: Dockerfile.allensdk
- tag: latest-gpu
dockerfile: Dockerfile.gpu
- name: gpu-matlab
dockerfile: Dockerfile.gpu.matlab
- tag: latest-gpu-allensdk
dockerfile: Dockerfile.gpu.allensdk

steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand All @@ -42,10 +43,10 @@ jobs:
- name: Build and push Docker Image
uses: docker/build-push-action@v6
with:
context: images
file: ${{ matrix.dockerfile }}
context: ./images
file: ./images/${{ matrix.dockerfile }}
push: true
tags: |
${{ secrets.DOCKERHUB_DANDIHUB_USERNAME }}/dandihub:latest-${{ matrix.image.name }}
cache-from: type=registry,ref=${{ secrets.DOCKERHUB_DANDIHUB_USERNAME }}/dandihub:latest-${{ matrix.image.name }}
${{ secrets.DOCKERHUB_DANDIHUB_USERNAME }}/dandihub:${{ matrix.tag }}
cache-from: type=registry,ref=${{ secrets.DOCKERHUB_DANDIHUB_USERNAME }}/dandihub:${{ matrix.tag }}
cache-to: type=inline
21 changes: 11 additions & 10 deletions .github/workflows/docker-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,16 @@ jobs:

strategy:
matrix:
image:
- name: base
include:
- tag: latest
dockerfile: Dockerfile
- name: matlab
dockerfile: Dockerfile.matlab
- name: gpu
- tag: latest-allensdk
dockerfile: Dockerfile.allensdk
- tag: latest-gpu
dockerfile: Dockerfile.gpu
- name: gpu-matlab
dockerfile: Dockerfile.gpu.matlab
- tag: latest-gpu-allensdk
dockerfile: Dockerfile.gpu.allensdk

steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand All @@ -34,8 +35,8 @@ jobs:
- name: Build Docker Image
uses: docker/build-push-action@v6
with:
context: images
file: ${{ matrix.dockerfile }}
context: ./images
file: ./images/${{ matrix.dockerfile }}
push: false
cache-from: type=registry,ref=${{ secrets.DOCKERHUB_DANDIHUB_USERNAME }}/dandihub:latest-${{ matrix.image.name }}
cache-from: type=registry,ref=${{ secrets.DOCKERHUB_DANDIHUB_USERNAME }}/dandihub:${{ matrix.tag }}
cache-to: type=inline
30 changes: 30 additions & 0 deletions envs/shared/jupyterhub.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ singleuser:
default: true
kubespawner_override:
image: "${singleuser_image_repo}:${singleuser_image_tag}"
allensdk:
display_name: "AllenSDK"
default: true
kubespawner_override:
image: "${singleuser_image_repo}:${singleuser_image_tag}-allensdk"
kubespawner_override:
image_pull_policy: Always
cpu_limit: 2
Expand All @@ -70,6 +75,11 @@ singleuser:
# default: true
# kubespawner_override:
# image: "${singleuser_image_repo}:${singleuser_image_tag}"
# allensdk:
# display_name: "AllenSDK"
# default: true
# kubespawner_override:
# image: "${singleuser_image_repo}:${singleuser_image_tag}-allensdk"
# matlab:
# display_name: "MATLAB (must provide your own license)"
# kubespawner_override:
Expand All @@ -94,6 +104,11 @@ singleuser:
default: true
kubespawner_override:
image: "${singleuser_image_repo}:${singleuser_image_tag}"
allensdk:
display_name: "AllenSDK"
default: true
kubespawner_override:
image: "${singleuser_image_repo}:${singleuser_image_tag}-allensdk"
matlab:
display_name: "MATLAB (must provide your own license)"
kubespawner_override:
Expand All @@ -119,6 +134,11 @@ singleuser:
default: true
kubespawner_override:
image: "${singleuser_image_repo}:${singleuser_image_tag}"
allensdk:
display_name: "AllenSDK"
default: true
kubespawner_override:
image: "${singleuser_image_repo}:${singleuser_image_tag}-allensdk"
matlab:
display_name: "MATLAB (must provide your own license)"
kubespawner_override:
Expand All @@ -142,6 +162,11 @@ singleuser:
default: true
kubespawner_override:
image: "${singleuser_image_repo}:${singleuser_image_tag}"
allensdk:
display_name: "AllenSDK"
default: true
kubespawner_override:
image: "${singleuser_image_repo}:${singleuser_image_tag}-allensdk"
matlab:
display_name: "MATLAB (must provide your own license)"
kubespawner_override:
Expand All @@ -165,6 +190,11 @@ singleuser:
default: true
kubespawner_override:
image: "${singleuser_image_repo}:${singleuser_image_tag}-gpu"
allensdk:
display_name: "AllenSDK GPU"
default: true
kubespawner_override:
image: "${singleuser_image_repo}:${singleuser_image_tag}-gpu-allensdk"
matlab:
display_name: "MATLAB GPU (must provide your own license)"
kubespawner_override:
Expand Down
12 changes: 3 additions & 9 deletions images/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM quay.io/jupyter/datascience-notebook:2024-02-06
FROM quay.io/jupyter/datascience-notebook:python-3.11.10

USER root

Expand Down Expand Up @@ -44,22 +44,16 @@ USER $NB_USER

RUN pip install --no-cache-dir jupyter-remote-desktop-proxy

# Install Allen SDK
RUN mamba create --yes -n allen -c conda-forge python=3.8 pip ipykernel 'h5py>=3.4=mpi*' \
&& /opt/conda/envs/allen/bin/pip install --no-cache-dir allensdk \
&& conda clean --all -f -y && rm -rf /tmp/*
ENV MAMBA_NO_LOW_SPEED_LIMIT=1

RUN mamba install --yes 'datalad>=0.18' rclone 'h5py>3.3=mpi*' ipykernel zarr blosc eccodes websockify \
&& wget --quiet https://raw.githubusercontent.com/DanielDent/git-annex-remote-rclone/v0.8/git-annex-remote-rclone \
&& chmod +x git-annex-remote-rclone && mv git-annex-remote-rclone /opt/conda/bin \
&& conda clean --all -f -y && rm -rf /tmp/*

RUN /opt/conda/envs/allen/bin/python -m ipykernel install --user --name allen \
--display-name="Allen SDK"

RUN pip install --no-cache-dir -U plotly jupyter_bokeh jupytext nbgitpuller datalad_container \
datalad-osf dandi nibabel nilearn pybids spikeinterface neo itkwidgets \
'pydra>=0.17' 'pynwb>=2.3.1' 'nwbwidgets>=0.10.2' hdf5plugin s3fs h5netcdf "xarray[io]" \
'pydra>=0.17' 'pynwb>=2.8.3' 'nwbwidgets>=0.10.2' hdf5plugin s3fs h5netcdf "xarray[io]" \
aicsimageio kerchunk 'neuroglancer>=2.28' cloud-volume ipywidgets ome-zarr \
webio_jupyter_extension https://github.com/balbasty/dandi-io/archive/refs/heads/main.zip \
tensorstore anndata
Expand Down
70 changes: 70 additions & 0 deletions images/Dockerfile.allensdk
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
FROM quay.io/jupyter/datascience-notebook:python-3.11.10

USER root

RUN apt update \
&& apt install -y software-properties-common \
&& add-apt-repository -y 'ppa:apptainer/ppa' \
&& apt update \
&& apt install -y apptainer-suid \
&& rm -rf /var/lib/apt/lists/* && rm -rf /tmp/*

RUN apt-get update && apt-get install -y ca-certificates libseccomp2 \
s3fs netbase less parallel tmux screen vim emacs htop curl \
&& rm -rf /var/lib/apt/lists/* && rm -rf /tmp/*

RUN curl --silent --show-error "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" \
-o "awscliv2.zip" && unzip awscliv2.zip \
&& ./aws/install && rm -rf ./aws awscliv2.zip

# Install jupyter server proxy and desktop
RUN curl -fsSLo /usr/share/keyrings/brave-browser-archive-keyring.gpg https://brave-browser-apt-release.s3.brave.com/brave-browser-archive-keyring.gpg \
&& echo "deb [signed-by=/usr/share/keyrings/brave-browser-archive-keyring.gpg] https://brave-browser-apt-release.s3.brave.com/ stable main"|sudo tee /etc/apt/sources.list.d/brave-browser-release.list \
&& apt-get -y -qq update \
&& apt-get -y -qq install \
dbus-x11 \
xfce4 \
xfce4-panel \
xfce4-session \
xfce4-settings \
xorg \
xubuntu-icon-theme \
brave-browser \
tigervnc-standalone-server \
tigervnc-xorg-extension \
# chown $HOME to workaround that the xorg installation creates a
# /home/jovyan/.cache directory owned by root
&& chown -R $NB_UID:$NB_GID $HOME \
&& rm -rf /var/lib/apt/lists/* && rm -rf /tmp/*

# apt-get may result in root-owned directories/files under $HOME
RUN mkdir /opt/extras && chown -R $NB_UID:$NB_GID $HOME /opt/extras

USER $NB_USER

RUN pip install --no-cache-dir jupyter-remote-desktop-proxy

ENV MAMBA_NO_LOW_SPEED_LIMIT=1

# Install Allen SDK
RUN mamba create --yes -n allen -c conda-forge python=3.8 pip ipykernel 'h5py>=3.4=mpi*' \
&& /opt/conda/envs/allen/bin/pip install --no-cache-dir allensdk \
&& conda clean --all -f -y && rm -rf /tmp/*

RUN mamba install --yes 'datalad>=0.18' rclone 'h5py>3.3=mpi*' ipykernel zarr blosc eccodes websockify \
&& wget --quiet https://raw.githubusercontent.com/DanielDent/git-annex-remote-rclone/v0.8/git-annex-remote-rclone \
&& chmod +x git-annex-remote-rclone && mv git-annex-remote-rclone /opt/conda/bin \
&& conda clean --all -f -y && rm -rf /tmp/*

RUN /opt/conda/envs/allen/bin/python -m ipykernel install --user --name allen \
--display-name="Allen SDK"

RUN pip install --no-cache-dir -U plotly jupyter_bokeh jupytext nbgitpuller datalad_container \
datalad-osf dandi pybids spikeinterface neo itkwidgets \
'pydra>=0.17' 'pynwb>=2.8.3' 'nwbwidgets>=0.10.2' hdf5plugin s3fs h5netcdf "xarray[io]" \
aicsimageio kerchunk cloud-volume ipywidgets ome-zarr \
webio_jupyter_extension https://github.com/balbasty/dandi-io/archive/refs/heads/main.zip \
tensorstore anndata

RUN pip install --no-cache-dir multiscale_spatial_image jupyterlab-git \
datalad-fuse
14 changes: 4 additions & 10 deletions images/Dockerfile.gpu
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM quay.io/jupyter/datascience-notebook:2024-02-06
FROM quay.io/jupyter/datascience-notebook:python-3.11.10

USER root

Expand Down Expand Up @@ -44,27 +44,21 @@ USER $NB_USER

RUN pip install --no-cache-dir jupyter-remote-desktop-proxy

# Install Allen SDK
RUN mamba create --yes -n allen -c conda-forge python=3.11 pip ipykernel 'h5py>=3.4=mpi*' \
&& /opt/conda/envs/allen/bin/pip install --no-cache-dir allensdk \
&& conda clean --all -f -y && rm -rf /tmp/*
ENV MAMBA_NO_LOW_SPEED_LIMIT=1

RUN mamba install --yes datalad rclone 'h5py>3.3=mpi*' ipykernel zarr blosc eccodes websockify \
&& wget --quiet https://raw.githubusercontent.com/DanielDent/git-annex-remote-rclone/v0.8/git-annex-remote-rclone \
&& chmod +x git-annex-remote-rclone && mv git-annex-remote-rclone /opt/conda/bin \
&& conda clean --all -f -y && rm -rf /tmp/*

RUN /opt/conda/envs/allen/bin/python -m ipykernel install --user --name allen \
--display-name="Allen SDK"

RUN pip install --no-cache-dir -U plotly jupyter_bokeh jupytext nbgitpuller datalad_container \
datalad-osf dandi nibabel nilearn pybids spikeinterface neo itkwidgets \
'pydra>=0.17' 'pynwb>=2.3.1' 'nwbwidgets>=0.10.2' hdf5plugin s3fs h5netcdf "xarray[io]" \
'pydra>=0.17' 'pynwb>=2.8.3' 'nwbwidgets>=0.10.2' hdf5plugin s3fs h5netcdf "xarray[io]" \
aicsimageio kerchunk 'neuroglancer>=2.28' cloud-volume ipywidgets ome-zarr \
webio_jupyter_extension https://github.com/balbasty/dandi-io/archive/refs/heads/main.zip \
tensorstore anndata && rm -rf /tmp/*

RUN mamba install --yes -c "nvidia/label/cuda-11.8.0" cuda-toolkit cudnn \
RUN mamba install --yes -c "nvidia/label/cuda-12.6.3" cuda-toolkit cudnn \
&& conda clean --all -f -y && rm -rf /tmp/*

RUN pip install --no-cache-dir multiscale_spatial_image jupyterlab-git \
Expand Down
73 changes: 73 additions & 0 deletions images/Dockerfile.gpu.allensdk
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
FROM quay.io/jupyter/datascience-notebook:python-3.11.10

USER root

RUN apt update \
&& apt install -y software-properties-common \
&& add-apt-repository -y 'ppa:apptainer/ppa' \
&& apt update \
&& apt install -y apptainer-suid \
&& rm -rf /var/lib/apt/lists/* && rm -rf /tmp/*

RUN apt-get update && apt-get install -y ca-certificates libseccomp2 \
s3fs netbase less parallel tmux screen vim emacs htop curl \
&& rm -rf /var/lib/apt/lists/* && rm -rf /tmp/*

RUN curl --silent --show-error "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" \
-o "awscliv2.zip" && unzip awscliv2.zip \
&& ./aws/install && rm -rf ./aws awscliv2.zip

# Install jupyter server proxy and desktop
RUN curl -fsSLo /usr/share/keyrings/brave-browser-archive-keyring.gpg https://brave-browser-apt-release.s3.brave.com/brave-browser-archive-keyring.gpg \
&& echo "deb [signed-by=/usr/share/keyrings/brave-browser-archive-keyring.gpg] https://brave-browser-apt-release.s3.brave.com/ stable main"|sudo tee /etc/apt/sources.list.d/brave-browser-release.list \
&& apt-get -y -qq update \
&& apt-get -y -qq install \
dbus-x11 \
xfce4 \
xfce4-panel \
xfce4-session \
xfce4-settings \
xorg \
xubuntu-icon-theme \
brave-browser \
tigervnc-standalone-server \
tigervnc-xorg-extension \
# chown $HOME to workaround that the xorg installation creates a
# /home/jovyan/.cache directory owned by root
&& chown -R $NB_UID:$NB_GID $HOME \
&& rm -rf /var/lib/apt/lists/* && rm -rf /tmp/*

# apt-get may result in root-owned directories/files under $HOME
RUN mkdir /opt/extras && chown -R $NB_UID:$NB_GID $HOME /opt/extras

USER $NB_USER

RUN pip install --no-cache-dir jupyter-remote-desktop-proxy

ENV MAMBA_NO_LOW_SPEED_LIMIT=1

# Install Allen SDK
RUN mamba create --yes -n allen -c conda-forge python=3.11 pip ipykernel 'h5py>=3.4=mpi*' \
&& /opt/conda/envs/allen/bin/pip install --no-cache-dir allensdk \
&& conda clean --all -f -y && rm -rf /tmp/*

RUN mamba install --yes datalad rclone 'h5py>3.3=mpi*' ipykernel zarr blosc eccodes websockify \
&& wget --quiet https://raw.githubusercontent.com/DanielDent/git-annex-remote-rclone/v0.8/git-annex-remote-rclone \
&& chmod +x git-annex-remote-rclone && mv git-annex-remote-rclone /opt/conda/bin \
&& conda clean --all -f -y && rm -rf /tmp/*

RUN /opt/conda/envs/allen/bin/python -m ipykernel install --user --name allen \
--display-name="Allen SDK"

RUN pip install --no-cache-dir -U plotly jupyter_bokeh jupytext nbgitpuller datalad_container \
datalad-osf dandi pybids spikeinterface neo itkwidgets \
'pydra>=0.17' 'pynwb>=2.8.3' 'nwbwidgets>=0.10.2' hdf5plugin s3fs h5netcdf "xarray[io]" \
aicsimageio kerchunk cloud-volume ipywidgets ome-zarr \
webio_jupyter_extension https://github.com/balbasty/dandi-io/archive/refs/heads/main.zip \
tensorstore anndata && rm -rf /tmp/*

RUN mamba install --yes -c "nvidia/label/cuda-11.8.0" cuda-toolkit cudnn \
&& conda clean --all -f -y && rm -rf /tmp/*

RUN pip install --no-cache-dir multiscale_spatial_image jupyterlab-git \
datalad-fuse jupyterlab_nvdashboard
4 changes: 3 additions & 1 deletion images/Dockerfile.gpu.matlab
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ USER $NB_USER

RUN pip install --no-cache-dir jupyter-remote-desktop-proxy jupyterlab_nvdashboard

ENV MAMBA_NO_LOW_SPEED_LIMIT=1

# Install CUDA toolkit and extension for GPU usage display
RUN CONDA_OVERRIDE_CUDA="12.3" mamba install --yes -c "nvidia/label/cuda-12.3.0" cuda-toolkit cudnn \
&& conda clean --all -f -y && rm -rf /tmp/*
Expand All @@ -72,7 +74,7 @@ RUN mamba install --yes datalad rclone 'h5py>3.3=mpi*' ipykernel zarr blosc gcc

RUN pip install --no-cache-dir plotly jupyter_bokeh jupytext nbgitpuller datalad_container \
datalad-osf dandi nibabel nilearn pybids spikeinterface neo \
'pydra>=0.17' 'pynwb>=2.3.1' 'nwbwidgets>=0.10.2' hdf5plugin s3fs h5netcdf "xarray[io]" \
'pydra>=0.17' 'pynwb>=2.8.3' 'nwbwidgets>=0.10.2' hdf5plugin s3fs h5netcdf "xarray[io]" \
aicsimageio kerchunk 'neuroglancer>=2.28' cloud-volume ipywidgets ome-zarr \
webio_jupyter_extension https://github.com/balbasty/dandi-io/archive/refs/heads/main.zip \
tensorstore anndata "tensorflow[and-cuda]==2.14"
Expand Down
4 changes: 2 additions & 2 deletions images/Dockerfile.matlab
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ USER $NB_USER

RUN pip install --no-cache-dir jupyter-remote-desktop-proxy jupyterlab_nvdashboard


ENV MAMBA_NO_LOW_SPEED_LIMIT=1

RUN mamba install --yes datalad rclone 'h5py>3.3=mpi*' ipykernel zarr blosc gcc eccodes websockify \
&& wget --quiet https://raw.githubusercontent.com/DanielDent/git-annex-remote-rclone/v0.7/git-annex-remote-rclone \
Expand All @@ -64,7 +64,7 @@ RUN mamba install --yes datalad rclone 'h5py>3.3=mpi*' ipykernel zarr blosc gcc

RUN pip install --no-cache-dir plotly jupyter_bokeh jupytext nbgitpuller datalad_container \
datalad-osf dandi nibabel nilearn pybids spikeinterface neo \
'pydra>=0.17' 'pynwb>=2.3.1' 'nwbwidgets>=0.10.2' hdf5plugin s3fs h5netcdf "xarray[io]" \
'pydra>=0.17' 'pynwb>=2.8.3' 'nwbwidgets>=0.10.2' hdf5plugin s3fs h5netcdf "xarray[io]" \
aicsimageio kerchunk 'neuroglancer>=2.28' cloud-volume ipywidgets ome-zarr \
webio_jupyter_extension https://github.com/balbasty/dandi-io/archive/refs/heads/main.zip \
tensorstore anndata tensorflow
Expand Down
Loading

0 comments on commit b085fbf

Please sign in to comment.