Skip to content

Commit

Permalink
Update Dockerfile
Browse files Browse the repository at this point in the history
install furqan software requests
  • Loading branch information
sepehrkrz committed Aug 19, 2024
1 parent aafbeab commit a2e26d7
Showing 1 changed file with 102 additions and 83 deletions.
185 changes: 102 additions & 83 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,95 +1,114 @@
# This Dockerfile aims to provide a Pangeo-style image with the VNC/Linux Desktop feature
# It was constructed by following the instructions and copying code snippets laid out
# and linked from here:
# https://github.com/2i2c-org/infrastructure/issues/1444#issuecomment-1187405324
# Start from a basic Ubuntu image
FROM ubuntu:20.04

FROM pangeo/pangeo-notebook:2024.04.08

USER root
# Avoid prompts from apt
ENV DEBIAN_FRONTEND=noninteractive
ENV PATH ${NB_PYTHON_PREFIX}/bin:$PATH

# Needed for apt-key to work
RUN apt-get update -qq --yes > /dev/null && \
apt-get install --yes -qq gnupg2 > /dev/null && \
rm -rf /var/lib/apt/lists/*

RUN apt-get -y update \
&& apt-get install -y dbus-x11 \
firefox \
xfce4 \
xfce4-panel \
xfce4-session \
xfce4-settings \
xorg \
xubuntu-icon-theme \
curl \
&& rm -rf /var/lib/apt/lists/*

# Install Node.js and npm
RUN curl -sL https://deb.nodesource.com/setup_16.x | bash - \
&& apt-get install -y nodejs

# Install TurboVNC (https://github.com/TurboVNC/turbovnc)
# Set up environment variables
ENV CONDA_DIR=/opt/conda
ENV PATH=$CONDA_DIR/bin:$PATH

# Install system dependencies
RUN apt-get update && apt-get install -y \
wget \
bzip2 \
ca-certificates \
sudo \
locales \
fonts-liberation \
run-one \
curl \
gnupg2 \
dbus-x11 \
firefox \
xfce4 \
xfce4-panel \
xfce4-session \
xfce4-settings \
xorg \
xubuntu-icon-theme \
libfontconfig1-dev \
libgdal-dev \
libgeos-dev \
libproj-dev \
nco \
build-essential \
libcurl4-openssl-dev \
libssl-dev \
libxml2-dev \
libudunits2-dev \
libnetcdf-dev \
sqlite3 \
libsqlite3-dev \
&& rm -rf /var/lib/apt/lists/*

# Install miniconda
RUN wget --quiet https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh && \
/bin/bash ~/miniconda.sh -b -p $CONDA_DIR && \
rm ~/miniconda.sh && \
# The following line has been corrected
$CONDA_DIR/bin/conda clean -a -y && \
ln -s $CONDA_DIR/etc/profile.d/conda.sh /etc/profile.d/conda.sh && \
echo ". $CONDA_DIR/etc/profile.d/conda.sh" >> ~/.bashrc && \
echo "conda activate base" >> ~/.bashrc

# Set up conda environment
RUN conda update -n base -c conda-forge conda && \
conda create -n notebook -c conda-forge \
python=3.11 \
jupyterlab \
notebook \
r-base \
r-irkernel \
r-devtools \
r-sp \
r-stringr \
r-plyr \
r-ggplot2 \
r-terra \
r-ncdf4 \
nodejs \
&& conda clean --all -f -y

# Activate conda environment
ENV PATH /opt/conda/envs/notebook/bin:$PATH
SHELL ["/bin/bash", "-c"]

# Install additional R packages
RUN source activate notebook && \
R -e "install.packages(c('rgdal', 'ggmap'), repos='https://cloud.r-project.org/')" && \
R -e "devtools::install_github('NCAR/rwrfhydro')"

# Install TurboVNC
ARG TURBOVNC_VERSION=2.2.6
RUN wget -q "https://sourceforge.net/projects/turbovnc/files/${TURBOVNC_VERSION}/turbovnc_${TURBOVNC_VERSION}_amd64.deb/download" -O turbovnc.deb \
&& apt-get update -qq --yes > /dev/null \
&& apt-get install -y ./turbovnc.deb > /dev/null \
# remove light-locker to prevent screen lock
&& apt-get remove -y light-locker > /dev/null \
&& rm ./turbovnc.deb \
&& ln -s /opt/TurboVNC/bin/* /usr/local/bin/ \
&& rm -rf /var/lib/apt/lists/*

RUN mamba install -n ${CONDA_ENV} -y websockify

# Install jupyter-remote-desktop-proxy with compatible npm version
RUN export PATH=${NB_PYTHON_PREFIX}/bin:${PATH} \
&& npm install -g npm@7.24.0 \
&& pip install --no-cache-dir \
https://github.com/jupyterhub/jupyter-remote-desktop-proxy/archive/main.zip

# Install jupyterlab_vim extension
RUN pip install jupyterlab_vim
RUN wget -q "https://sourceforge.net/projects/turbovnc/files/${TURBOVNC_VERSION}/turbovnc_${TURBOVNC_VERSION}_amd64.deb/download" -O turbovnc.deb && \
apt-get update -qq --yes > /dev/null && \
apt-get install -y ./turbovnc.deb > /dev/null && \
apt-get remove -y light-locker > /dev/null && \
rm ./turbovnc.deb && \
ln -s /opt/TurboVNC/bin/* /usr/local/bin/ && \
rm -rf /var/lib/apt/lists/*

# TO download the folder/files:
RUN pip install jupyter-tree-download
# Install jupyter-remote-desktop-proxy
RUN pip install --no-cache-dir \
https://github.com/jupyterhub/jupyter-remote-desktop-proxy/archive/main.zip

# Install Google Cloud SDK (gcloud, gsutil)
RUN apt-get update && \
apt-get install -y curl gnupg && \
echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] http://packages.cloud.google.com/apt cloud-sdk main" | tee -a /etc/apt/sources.list.d/google-cloud-sdk.list && \
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key --keyring /usr/share/keyrings/cloud.google.gpg add - && \
# Install Google Cloud SDK
RUN echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] http://packages.cloud.google.com/apt cloud-sdk main" | tee -a /etc/apt/sources.list.d/google-cloud-sdk.list && \
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key --keyring /usr/share/keyrings/cloud.google.gpg add - && \
apt-get update -y && \
apt-get install google-cloud-sdk -y

# Install packages: spatialpandas, easydev, colormap, colorcet, duckdb, dask_geopandas, hydrotools, sidecar
RUN pip install spatialpandas easydev colormap colorcet duckdb dask_geopandas hydrotools sidecar

# Upgrade colorama to resolve dependency conflict
RUN pip install --upgrade colorama

# Install nb_black separately to address metadata generation issue
RUN pip install nb_black==1.0.5

# Gfortran support
#RUN apt-get update && \
# apt-get install -yq python3.9 python3-pip python3-wheel make cmake gfortran gcc-multilib libnetcdff-dev libcoarrays-dev libopenmpi-dev && \
# apt-get clean -q
#RUN pip3 install numpy pandas xarray netcdf4 joblib toolz pyyaml Cython

# Install nbfetch for hydroshare
RUN pip install -U --no-cache-dir --upgrade-strategy only-if-needed git+https://github.com/hydroshare/nbfetch.git@hspuller-auth
# enable jupyter_server extension
RUN jupyter server extension enable --py nbfetch --sys-prefix

# Install google cloud bigquery
RUN pip install google-cloud-bigquery
# Set up Jupyter Lab
RUN mkdir /opt/notebooks && \
jupyter notebook --generate-config && \
echo "c.NotebookApp.ip = '0.0.0.0'" >> ~/.jupyter/jupyter_notebook_config.py && \
echo "c.NotebookApp.open_browser = False" >> ~/.jupyter/jupyter_notebook_config.py

# Update custom Jupyter Lab settings
RUN sed -i 's/\"default\": true/\"default\": false/g' /srv/conda/envs/notebook/share/jupyter/labextensions/@axlair/jupyterlab_vim/schemas/@axlair/jupyterlab_vim/plugin.json
WORKDIR /opt/notebooks

# Install dataretrieval package
RUN pip install dataretrieval
# Expose port for Jupyter Lab
EXPOSE 8888

USER ${NB_USER}
# Start Jupyter Lab
CMD ["jupyter", "lab", "--ip=0.0.0.0", "--allow-root"]

0 comments on commit a2e26d7

Please sign in to comment.