Skip to content

Commit

Permalink
Update MATLAB docker file with last 2024b version
Browse files Browse the repository at this point in the history
  • Loading branch information
aranega committed Jan 17, 2025
1 parent b306552 commit f09597a
Showing 1 changed file with 21 additions and 81 deletions.
102 changes: 21 additions & 81 deletions images/Dockerfile.matlab
Original file line number Diff line number Diff line change
@@ -1,84 +1,25 @@
ARG MATLAB_RELEASE=r2023a
FROM --platform=linux/amd64 ghcr.io/mathworks-ref-arch/matlab-integration-for-jupyter/jupyter-byoi-matlab-notebook:${MATLAB_RELEASE}
ARG MATLAB_RELEASE=r2024b
FROM --platform=linux/amd64 ghcr.io/mathworks-ref-arch/matlab-integration-for-jupyter/jupyter-matlab-notebook:${MATLAB_RELEASE}

USER root
ARG VERSION="1.1.5"

# install extra apps, add extra folder and fix ownership in case apt-get messed with it
ARG EXTRA_DIR=/opt/extras
RUN apt-get update \
&& apt-get install -y htop curl git build-essential \
&& rm -rf /tmp/* \
&& mkdir ${EXTRA_DIR} \
&& chown -R $NB_UID:$NB_GID $HOME ${EXTRA_DIR}

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 \
uidmap squashfs-tools squashfuse fuse2fs fuse-overlayfs fakeroot \
s3fs netbase less parallel tmux screen vim emacs htop curl \
git build-essential \
&& 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 update \
&& apt-get install -y \
dbus-x11 \
libgl1-mesa-glx \
xfce4 \
xfce4-panel \
xfce4-session \
xfce4-settings \
xorg \
xubuntu-icon-theme \
brave-browser \
&& rm -rf /tmp/*

# Remove light-locker to prevent screen lock
ARG TURBOVNC_VERSION=3.0.2
RUN wget -q "https://sourceforge.net/projects/turbovnc/files/${TURBOVNC_VERSION}/turbovnc_${TURBOVNC_VERSION}_amd64.deb/download" -O turbovnc_${TURBOVNC_VERSION}_amd64.deb && \
apt-get install -y -q ./turbovnc_${TURBOVNC_VERSION}_amd64.deb && \
apt-get remove -y -q light-locker && \
rm ./turbovnc_${TURBOVNC_VERSION}_amd64.deb && \
ln -s /opt/TurboVNC/bin/* /usr/local/bin/ \
&& rm -rf /tmp/*

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

USER $NB_USER

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



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 \
&& chmod +x git-annex-remote-rclone && mv git-annex-remote-rclone /opt/conda/bin \
&& conda clean --all -f -y && rm -rf /tmp/*

RUN pip install --no-cache-dir plotly jupyter_bokeh jupytext nbgitpuller datalad_container \
RUN pip install --no-cache-dir datalad 'h5py>3.3' zarr pyopenssl 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]" \
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


# Ensure OpenSSL is up-to-date
RUN pip install -U pyopenssl

# Install the jupyter-matlab kernel and matlab-proxy
RUN pip install --no-cache-dir jupyter-matlab-proxy

# Install the required Toolboxes with user root
# Optimization toolbox is a required dependency
USER root
ARG MATLAB_RELEASE
ARG TOOLBOXES="Bioinformatics_Toolbox \
Computer_Vision_Toolbox \
Expand All @@ -94,40 +35,39 @@ ARG TOOLBOXES="Bioinformatics_Toolbox \
Wavelet_Toolbox \
Deep_Learning_Toolbox_Converter_for_TensorFlow_models"
RUN wget -q https://www.mathworks.com/mpm/glnxa64/mpm && \
chmod +x mpm
RUN ./mpm install \
chmod +x mpm && \
./mpm install \
--release=${MATLAB_RELEASE} \
--destination=/opt/matlab \
--products ${TOOLBOXES} && \
rm -f mpm /tmp/mathworks_root.log

# Switch back to NB_USER for addons and live-scripts installations
# Switch to NB_USER for addons and live-scripts installations
USER $NB_USER

## Adds add-ons and register them in the Matlab instance
# Patch startup.m to automatically register the addons
# The registration process simply iterate over all entries from the ADDONS_DIR folder
# and add them to the "path"
ARG ADDONS_DIR=${EXTRA_DIR}/dandi
ARG STARTUP_SCRIPT=/opt/conda/lib/python3.10/site-packages/matlab_proxy/matlab/startup.m

# Install the live-scripts examples
# RUN git clone https://github.com/INCF/example-live-scripts ${ADDONS_DIR}/example-live-scripts
ARG STARTUP_SCRIPT=/opt/conda/lib/python3.11/site-packages/matlab_proxy/matlab/startup.m

# Generate MATLAB startup script
RUN echo -e "\n\
% Sets the number of workers for 'Processes' to 5\n\
% Set the number of workers for 'Processes' to 5\n\
cluster = parcluster('Processes'); \n\
cluster.NumWorkers = 5; \n\
saveProfile(cluster); \n\
\n\
% Copy the live-example folder \n\
homedirExamples = strcat(getenv('HOME'), '/example-live-scripts') \n\
if not(isfolder(homedirExamples)) \n\
% copyfile('${ADDONS_DIR}/example-live-scripts', homedirExamples) \n\
% repo = gitclone('https://github.com/INCF/example-live-scripts', homedirExamples, Depth=1); \n\
system(strcat(string('git clone --depth=1 https://github.com/INCF/example-live-scripts '), homedirExamples)) \n\
% repo = gitclone('https://github.com/MATLAB-Community-Toolboxes-at-INCF/example-live-scripts', homedirExamples, Depth=1); \n\
repo = gitclone('https://github.com/aranega/example-live-scripts', homedirExamples, Depth=1); \n\
end \n\
% Adds the addons to the path \n\
% Add the example library to the path \n\
addpath(homedirExamples); \n\
% Add the addons to the path \n\
addons = dir('${ADDONS_DIR}'); \n\
addons = setdiff({addons([addons.isdir]).name}, {'.', '..'}); \n\
for addon_idx = 1:numel(addons) \n\
Expand All @@ -139,7 +79,7 @@ generateCore(); % Generate the most recent nwb-schema \n\
clear" >> ${STARTUP_SCRIPT}

# Variables for addons management that are tied to a specific release
ARG ADDONS_RELEASES="https://github.com/NeurodataWithoutBorders/matnwb/archive/refs/tags/v2.6.0.2.zip \
ARG ADDONS_RELEASES="https://github.com/NeurodataWithoutBorders/matnwb/archive/refs/tags/v2.7.0.zip \
https://github.com/schnitzer-lab/EXTRACT-public/archive/refs/heads/master.zip \
https://github.com/bahanonu/ciatah/archive/refs/heads/master.zip"

Expand Down

0 comments on commit f09597a

Please sign in to comment.