From c810a9cf3891e586f450d9140aaaadb469fc7db5 Mon Sep 17 00:00:00 2001 From: Jakub Kaczmarzyk Date: Thu, 20 May 2021 12:10:03 -0400 Subject: [PATCH] update base image + pkg installs + maintainer The previous version of the Dockerfile would succeed in building for some reason. This commit fixes that issue and in general cleans up the dockerfile. Most packages are installed from conda, and those that are not installable from conda are installed with pip. The base image is changed to miniconda3 to make the image smaller. Conda takes care of all of pytorch's dependencies. I (@kaczmarj) was able to use this Dockerfile to run inference on a whole slide image. I did this on a CPU and have not tested on GPU. --- Dockerfile | 51 ++++++++++++++++++++++++++++----------------------- 1 file changed, 28 insertions(+), 23 deletions(-) diff --git a/Dockerfile b/Dockerfile index ea4a7ac..9ea96cc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,27 +1,32 @@ -FROM pytorch/pytorch:1.0.1-cuda10.0-cudnn7-devel -MAINTAINER Tahsin Kurc +FROM continuumio/miniconda3:4.9.2 +LABEL maintainer="Jakub Kaczmarzyk " -RUN apt-get -y update && \ - apt-get install --yes python3-openslide wget zip libgl1-mesa-glx libgl1-mesa-dev && \ - pip install --upgrade pip && \ - conda update -n base -c defaults conda && \ - pip3 install setuptools==45 && \ - pip install cython && \ - conda install --yes pytorch=0.4.1 cuda90 -c pytorch && \ - conda install --yes scikit-learn && \ - pip install "Pillow<7" pymongo pandas && \ - pip install torchvision==0.2.1 && \ - conda install --yes -c conda-forge opencv +RUN apt-get update \ + && apt-get install --yes \ + gcc \ + libgl1-mesa-glx \ + openslide-tools \ + && rm -rf /var/lib/apt/lists/* -RUN pip install openslide-python - -ENV BASE_DIR="/quip_app/quip_paad_cancer_detection" -ENV PATH="./":$PATH - -COPY . ${BASE_DIR}/. - -RUN chmod 0755 ${BASE_DIR}/scripts/* - -WORKDIR ${BASE_DIR}/scripts +# TODO: this should go in an environment.yml file. +RUN conda create -n histo --yes --quiet \ + --channel pytorch \ + --channel conda-forge \ + cuda90 \ + pandas \ + "pillow<7" \ + pytorch=0.4.1 \ + scikit-learn \ + torchvision==0.2.1 \ + && /opt/conda/envs/histo/bin/python -m pip install --no-cache-dir \ + opencv-python \ + openslide-python \ + pymongo +ENV "/opt/conda/envs/histo/bin:$PATH" +WORKDIR /quip_app/quip_paad_cancer_detection +COPY . . +RUN chmod +x scripts/svs_2_heatmap.sh +ENV PATH="/quip_app/quip_paad_cancer_detection/scripts:$PATH" +WORKDIR scripts CMD ["/bin/bash"]