From eff495b24f14763826a41995bfead3f67821bbf8 Mon Sep 17 00:00:00 2001 From: Tim Kempchen <80586406+TKempchen@users.noreply.github.com> Date: Tue, 2 Jul 2024 11:41:47 +0200 Subject: [PATCH] update docker files --- Docker/SPACEc_cpu | 12 +++-- Docker/SPACEc_gpu | 1 - Docker/old/Dockerfile | 94 ---------------------------------- Docker/old/tutorial.Dockerfile | 66 ------------------------ Docker/old/tutorial_init.sh | 44 ---------------- 5 files changed, 7 insertions(+), 210 deletions(-) delete mode 100755 Docker/old/Dockerfile delete mode 100644 Docker/old/tutorial.Dockerfile delete mode 100644 Docker/old/tutorial_init.sh diff --git a/Docker/SPACEc_cpu b/Docker/SPACEc_cpu index d56aa88..61cdc8f 100644 --- a/Docker/SPACEc_cpu +++ b/Docker/SPACEc_cpu @@ -1,5 +1,5 @@ -# Start from a base CUDA image -FROM ubuntu:20.04 +# Start from a base image +FROM debian:bullseye-slim # Update the package list RUN apt-get update && \ @@ -41,19 +41,21 @@ RUN conda run pip install spacec RUN conda run pip install "TissUUmaps" && \ conda install libxml2=2.9.10 && \ conda run pip install torch_geometric && \ - conda run pip install pyg_lib torch_scatter torch_sparse torch_cluster torch_spline_conv -f https://data.pyg.org/whl/torch-2.3.0+cu121.html && \ + conda run pip install pyg_lib torch_scatter torch_sparse torch_cluster torch_spline_conv -f https://data.pyg.org/whl/torch-2.3.0+cu121.html # Copy notebooks into a new directory in the Docker image COPY notebooks /notebooks -COPY example_data /example_data # Set the new directory as the working directory WORKDIR /notebooks +# Clean up to reduce image size +RUN conda clean -afy + # Expose Jupyter port EXPOSE 8888 EXPOSE 5100 # Set the default command to run Jupyter -CMD ["conda", "run", "-n", "spacec", "jupyter", "notebook", "--ip='0.0.0.0'", "--port=8888", "--no-browser", "--allow-root", "--NotebookApp.token=''"] +CMD ["conda", "run", "-n", "spacec", "jupyter", "notebook", "--ip='0.0.0.0'", "--port=8888", "--no-browser", "--allow-root", "--NotebookApp.token=''"] \ No newline at end of file diff --git a/Docker/SPACEc_gpu b/Docker/SPACEc_gpu index e3a16c5..988feda 100644 --- a/Docker/SPACEc_gpu +++ b/Docker/SPACEc_gpu @@ -49,7 +49,6 @@ RUN conda run pip install "TissUUmaps" && \ # Copy notebooks into a new directory in the Docker image COPY notebooks /notebooks -COPY example_data /example_data # Set the new directory as the working directory WORKDIR /notebooks diff --git a/Docker/old/Dockerfile b/Docker/old/Dockerfile deleted file mode 100755 index a040805..0000000 --- a/Docker/old/Dockerfile +++ /dev/null @@ -1,94 +0,0 @@ -# Copyright (c) Jupyter Development Team. -# Distributed under the terms of the Modified BSD License. -ARG OWNER=jupyter -ARG BASE_CONTAINER=$OWNER/r-notebook -FROM $BASE_CONTAINER - -LABEL maintainer="Jupyter Project " - -# Fix: https://github.com/hadolint/hadolint/wiki/DL4006 -# Fix: https://github.com/koalaman/shellcheck/wiki/SC3014 -SHELL ["/bin/bash", "-o", "pipefail", "-c"] - -USER root - -RUN apt-get update --yes && \ - apt-get install --yes --no-install-recommends \ - # for cython: https://cython.readthedocs.io/en/latest/src/quickstart/install.html - build-essential \ - # for latex labels - cm-super \ - dvipng \ - # for matplotlib anim - ffmpeg && \ - apt-get clean && rm -rf /var/lib/apt/lists/* - -USER ${NB_UID} - -# Install Python 3 packages -RUN mamba install --yes \ - 'altair' \ - 'beautifulsoup4' \ - 'bokeh' \ - 'bottleneck' \ - 'cloudpickle' \ - 'conda-forge::blas=*=openblas' \ - 'cython' \ - 'dask' \ - 'dill' \ - 'h5py' \ - 'ipympl'\ - 'ipywidgets' \ - 'jupyter_server>=2.0.0' \ - 'jupyterlab-git' \ - 'matplotlib-base=3.6.3' \ - 'numba=0.55.2' \ - 'numexpr' \ - 'numpy=1.22.3' \ - 'openpyxl' \ - 'pandas=1.5.3' \ - 'patsy' \ - 'protobuf' \ - 'pytables' \ - 'tensorly' \ - 'scanpy' \ - 'scikit-image' \ - 'scikit-learn' \ - 'scipy' \ - 'seaborn=0.12.2' \ - 'sqlalchemy' \ - 'statsmodels=0.13.5' \ - 'sympy' \ - 'widgetsnbextension'\ - 'yellowbrick=1.5' \ - "graphviz" \ - "pydot" \ - "pygraphviz" \ - 'xlrd' && \ - mamba clean --all -f -y && \ - fix-permissions "${CONDA_DIR}" && \ - fix-permissions "/home/${NB_USER}" - -# Install facets which does not have a pip or conda package at the moment -WORKDIR /tmp -RUN git clone https://github.com/PAIR-code/facets.git && \ - jupyter nbextension install facets/facets-dist/ --sys-prefix && \ - rm -rf /tmp/facets && \ - fix-permissions "${CONDA_DIR}" && \ - fix-permissions "/home/${NB_USER}" - -# Import matplotlib the first time to build the font cache. -ENV XDG_CACHE_HOME="/home/${NB_USER}/.cache/" - -RUN MPLBACKEND=Agg python -c "import matplotlib.pyplot" && \ - fix-permissions "/home/${NB_USER}" - -RUN NotebookApp.iopub_data_rate_limit=1.0e10 - -WORKDIR "${HOME}" - - -COPY SAP_helperfunctions_hf.py . -COPY SAP_preprocessing_pp.py . -COPY SAP_tools_tl.py . -COPY SAP_plot_pl.py . diff --git a/Docker/old/tutorial.Dockerfile b/Docker/old/tutorial.Dockerfile deleted file mode 100644 index 692cc2b..0000000 --- a/Docker/old/tutorial.Dockerfile +++ /dev/null @@ -1,66 +0,0 @@ -ARG BASE_IMAGE=ubuntu:22.04 -FROM ${BASE_IMAGE} - -# install packages -RUN apt-get -y update --allow-releaseinfo-change\ - && apt-get -y autoremove \ - && apt-get clean \ - && apt-get install -y \ - fonts-liberation \ - locales \ - wget curl \ - unzip \ - # - bzip2 is necessary to extract the micromamba executable. - bzip2 \ - # - pandoc is used to convert notebooks to html files - # it's not present in aarch64 ubuntu image, so we install it here - pandoc \ - git \ - vim \ - zsh \ - tmux \ - build-essential \ - gcc \ - # clean up - && rm -fr /var/lib/apt/lists/* /tmp/* /var/tmp/* \ - && echo "en_US.UTF-8 UTF-8" > /etc/locale.gen \ - && locale-gen - -# TODO: not really sure why I need this -ENV LC_ALL=en_US.UTF-8 \ - LANG=en_US.UTF-8 \ - LANGUAGE=en_US.UTF-8 - -# install and setup micromamba -ENV MAMBA_ROOT_PREFIX=/opt/mamba -RUN curl -Ls https://micro.mamba.pm/api/micromamba/linux-64/latest | tar -xvj bin/micromamba \ - && /bin/micromamba shell init -s zsh -p ${MAMBA_ROOT_PREFIX} \ - && echo "alias mamba=micromamba" >> ~/.zshrc -ENV MAMBA_EXEC=/bin/micromamba - -ARG ENV_NAME="SPACEc" -RUN ${MAMBA_EXEC} env create -n ${ENV_NAME} -c conda-forge python=3.10 jupyterlab - -# install python packages -ARG GITHUB_USER -ARG GITHUB_TOKEN -RUN ${MAMBA_EXEC} run -n ${ENV_NAME} pip install --no-cache-dir \ - git+https://${GITHUB_USER}:${GITHUB_TOKEN}@github.com/yuqiyuqitan/SAP.git@preppip - - -# download tutorial files and run jupyterlab on startup - -ENV ENV_NAME=${ENV_NAME} -EXPOSE 8888 - -# attempt to fix situation by running with -u $UID -# but then new files end up with weird permissions: drwxr-Sr--+ -# probably could be done easier with some MAMBA path change -#RUN \ -# mkdir -p /.cache/mamba; chmod -R 777 /.cache; \ -# mkdir /.local; chmod 777 /.local; \ -# mkdir /.jupyter; chmod 777 /.jupyter; - -WORKDIR /workspace -COPY tutorial_init.sh / -CMD ["bash", "/tutorial_init.sh"] diff --git a/Docker/old/tutorial_init.sh b/Docker/old/tutorial_init.sh deleted file mode 100644 index 9d4da6b..0000000 --- a/Docker/old/tutorial_init.sh +++ /dev/null @@ -1,44 +0,0 @@ -echo -echo "Starting SpacCodEx environment" -echo "==============================" - -# TODO: tryin to fix issue with extracted files keeing ids from inside the archive -#echo "Setup for user: ${RUN_UID}" -#useradd --uid ${RUN_UID} spacec -#mkdir /home/spacec -#chown -R spacec:spacec /home/spacec -#chown -R ${RUN_ID}:${RUN_ID} /workspace - -echo "Checking tutorial materials." -cd /workspace - -# if data and notebook folder do not exist -if [ ! -d "/workspace/data" ] && [ ! -d "/workspace/notebooks" ]; then - echo "Data and notebooks for the tutorial are missing." - read -p "Do you want to download the tutorial materials? [y/n] " -n 1 -r - echo - if [[ ! $REPLY =~ ^[Yy]$ ]]; then - echo "Skipping download." - else - echo - echo "Downloading tutorial materials:" - wget -O materials.zip "https://www.dropbox.com/scl/fo/qxgrxq6y7y2jlrwhotabd/h?rlkey=3rp5cjkkrexnfxkqbtgr7l3h6&dl=1" - unzip materials.zip - rm materials.zip - echo - echo "Downloading model:" - mkdir -p notebooks/models/Mesmer_model - cd notebooks/models/Mesmer_model - wget -O model.tar.gz "https://deepcell-data.s3-us-west-1.amazonaws.com/saved-models/MultiplexSegmentation-9.tar.gz" - tar -xzvf model.tar.gz - rm model.tar.gz - chown -R ${UID}:${UID} . - cd - - fi -else - echo "Data and notebooks folders for the tutorial are present. Skipping download." -fi - -echo -echo "Starting Jupyter Lab:" -${MAMBA_EXEC} run -n ${ENV_NAME} jupyter lab --allow-root --NotebookApp.token="" --ip="*"