Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 84 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
from dataintuitive/viash:latest

RUN rm -rf /etc/apt/sources.list.d/sbt*
RUN mkdir /opt/conda && \
ln -s /opt/conda /srv/conda
ENV APP_BASE=/srv
ENV CONDA_DIR=/srv/conda
ENV CONDA_BIN=${CONDA_DIR}/bin
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get -qq update && \
apt-get -qq upgrade -y && \
apt-get -qq install --yes --no-install-recommends \
gettext-base \
gnupg \
locales \
wget \
curl \
bzip2 \
ca-certificates \
ssh \
file \
git \
awscli \
rsync \
sudo \
openssh-server \
htop \
screen \
> /dev/null && \
apt-get -qq purge && \
apt-get -qq clean && \
rm -rf /var/lib/apt/lists/* && \
mkdir -p /run/sshd && \
chmod 755 /run/sshd && \
echo "en_US.UTF-8 UTF-8" > /etc/locale.gen && \
locale-gen
ENV LC_ALL en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US.UTF-8
ENV SHELL /bin/bash
ENV NB_USER=jovyan
ENV NB_UID=1000
ENV USER=${NB_USER}
ENV HOME=/home/${NB_USER}

RUN adduser --disabled-password \
--gecos "Default user" \
--uid ${NB_UID} \
${NB_USER} && \
echo "$NB_USER ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/notebook && \
mkdir -p ${APP_BASE} && \
chown 1000:1000 -R /opt/conda && \
chown -R $NB_USER:$NB_USER ${APP_BASE}
USER ${NB_USER}

COPY install-miniconda.bash /tmp/install-miniconda.bash
RUN bash /tmp/install-miniconda.bash
COPY install-jupyter.bash /tmp/install-jupyter.bash
COPY environment.yml /tmp/environment.yml
RUN bash /tmp/install-jupyter.bash && \
echo '' > ${CONDA_DIR}/conda-meta/history && \
${CONDA_BIN}/conda config --system --add channels conda-forge && \
${CONDA_BIN}/conda config --system --set auto_update_conda false && \
${CONDA_BIN}/conda config --system --set show_channel_urls true
ENV NPM_DIR ${APP_BASE}/npm
ENV NB_PYTHON_PREFIX ${CONDA_DIR}/envs/saturn
ENV PATH ${NB_PYTHON_PREFIX}/bin:${CONDA_BIN}:${NPM_DIR}/bin:${HOME}/.local/bin:${PATH}
WORKDIR ${HOME}

USER root
RUN curl -s https://get.nextflow.io | bash && \
mv nextflow /usr/local/bin


COPY requirements.txt /tmp/requirements.txt
RUN /opt/conda/bin/conda install -n saturn python=3.7 pip ipykernel
RUN /opt/conda/envs/saturn/bin/pip install --no-cache-dir -r /tmp/requirements.txt
# install AWS CLI
RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
RUN unzip -q awscliv2.zip
RUN ./aws/install
RUN /opt/conda/envs/saturn/bin/python -m ipykernel install --name python3 --display-name 'saturn (Python 3)' --prefix=/opt/conda

USER ${NB_USER}
23 changes: 23 additions & 0 deletions docker/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
channels:
- defaults
- conda-forge
dependencies:
- nodejs
- python
- ipywidgets
- jupyterlab-git
- jupyterlab=2.2.9
- nbconvert
- notebook
- jupyter-server-proxy
- dask-core
- distributed
- dask-labextension
- yarl
- pyviz_comms
- jupyterlab_code_formatter=1.3.8
- black
- isort
- tornado
- nbdime
- voila
35 changes: 35 additions & 0 deletions docker/install-jupyter.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/bash

set -ex
export PATH="${CONDA_BIN}:${PATH}"

cd $(dirname $0)

echo "installing root env:"
cat /tmp/environment.yml
conda install -c conda-forge mamba
mamba env update -n root -f /tmp/environment.yml
jupyter serverextension enable --sys-prefix jupyter_server_proxy
jupyter serverextension enable dask_labextension --sys-prefix
jupyter serverextension enable --py jupyterlab_code_formatter --sys-prefix

# jupyter labextension install @bokeh/jupyter_bokeh
# jupyter labextension install @jupyter-widgets/jupyterlab-manager
# jupyter labextension install dask-labextension@3.0.0
# jupyter labextension install @ryantam626/jupyterlab_code_formatter
# jupyter labextension install @pyviz/jupyterlab_pyviz
# jupyter labextension install jupyterlab-execute-time
# jupyter labextension install @telamonian/theme-darcula
# jupyter labextension install jupyterlab-python-file

conda clean -afy
jupyter lab clean
jlpm cache clean
npm cache clean --force
find ${CONDA_DIR}/ -type f,l -name '*.pyc' -delete
find ${CONDA_DIR}/ -type f,l -name '*.a' -delete
find ${CONDA_DIR}/ -type f,l -name '*.js.map' -delete
rm -rf $HOME/.node-gyp
rm -rf $HOME/.local

conda create -n saturn
30 changes: 30 additions & 0 deletions docker/install-miniconda.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash

set -ex

cd $(dirname $0)

MINICONDA_VERSION=py37_4.9.2
URL="https://repo.continuum.io/miniconda/Miniconda3-${MINICONDA_VERSION}-Linux-x86_64.sh"
INSTALLER_PATH=/tmp/miniconda-installer.sh
wget --quiet $URL -O ${INSTALLER_PATH}
chmod +x ${INSTALLER_PATH}

MD5SUM="3143b1116f2d466d9325c206b7de88f7"

if ! echo "${MD5SUM} ${INSTALLER_PATH}" | md5sum --quiet -c -; then
echo "md5sum mismatch for ${INSTALLER_PATH}, exiting!"
exit 1
fi

bash ${INSTALLER_PATH} -b -p ${CONDA_DIR} -f

export PATH="${CONDA_BIN}:$PATH"

# Update conda
conda update -y conda

# Allow easy direct installs from conda forge
conda config --system --add channels conda-forge
conda config --system --set auto_update_conda false
conda config --system --set show_channel_urls true
23 changes: 23 additions & 0 deletions docker/profile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
if [ "${PS1-}" ]; then
if [ "${BASH-}" ] && [ "$BASH" != "/bin/sh" ]; then
# The file bash.bashrc already sets the default PS1.
# PS1='\h:\w\$ '
if [ -f /etc/bash.bashrc ]; then
. /etc/bash.bashrc
fi
else
if [ "`id -u`" -eq 0 ]; then
PS1='# '
else
PS1='$ '
fi
fi
fi
if [ -d /etc/profile.d ]; then
for i in /etc/profile.d/*.sh; do
if [ -r $i ]; then
. $i
fi
done
unset i
fi
1 change: 1 addition & 0 deletions docker/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
numpy