From 22357de25b8fbe5353cb202bf58fffffbc5a5e6a Mon Sep 17 00:00:00 2001 From: Suraj Pai Date: Thu, 2 Sep 2021 13:18:11 +0200 Subject: [PATCH] Simplify dockerfile --- docker/Dockerfile | 60 ++++++++++++----------------------------------- 1 file changed, 15 insertions(+), 45 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 3c23fd9..1223eff 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,61 +1,31 @@ -FROM nvidia/cuda:10.1-cudnn7-devel-ubuntu18.04 - -ENV CUDA_PATH /usr/local/cuda -ENV CUDA_ROOT /usr/local/cuda/bin -ENV LD_LIBRARY_PATH /usr/local/nvidia/lib64 +FROM pytorch/pytorch:1.9.0-cuda10.2-cudnn7-devel RUN apt-get -qq update # libsm6 and libxext6 are needed for cv2 -RUN apt-get update && apt-get install -y libxext6 libsm6 libxrender1 build-essential sudo \ +RUN apt-get update && apt-get install -y libxext6 libglib2.0-0 libsm6 build-essential sudo \ libgl1-mesa-glx git wget rsync tmux nano dcmtk fftw3-dev liblapacke-dev libpng-dev libopenblas-dev jq && \ rm -rf /var/lib/apt/lists/* -RUN ldconfig - -# Make a user - - -RUN adduser --disabled-password --gecos '' runner -# RUN adduser runner sudo -RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers -ARG USER_ID -ARG GROUP_ID -RUN usermod -u ${USER_ID} runner -RUN usermod -g ${GROUP_ID} runner -USER runner +RUN adduser --disabled-password --gecos '' ganslate_user +USER ganslate_user +# Setup apex for mixed precision WORKDIR /tmp -RUN wget -q https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -RUN bash Miniconda3-latest-Linux-x86_64.sh -b - -ENV PATH "/home/runner/miniconda3/bin:$PATH:$CUDA_ROOT" - -# Setup python packages -RUN conda update -n base conda -yq -RUN conda install python=3.8 -RUN conda install numpy pyyaml mkl mkl-include setuptools cmake cffi typing boost -RUN conda install pytorch torchvision cudatoolkit=10.1 -c pytorch -RUN conda install scipy pandas scikit-learn scikit-image -yq -RUN conda install cython tqdm jupyter sqlalchemy -yq - RUN git clone https://github.com/NVIDIA/apex \ && cd apex \ - && pip install -v --no-cache-dir --global-option="--cpp_ext" --global-option="--cuda_ext" ./ \ + && pip install -v --disable-pip-version-check --no-cache-dir ./ \ && cd .. -RUN python -m pip install opencv-python simpleitk h5py -q -RUN python -m pip install tb-nightly wandb -q -RUN python -m pip install monai memcnn -q -RUN python -m pip install omegaconf loguru -q - - USER root - -# Create folders for input and output -RUN mkdir /ganslate && chmod 777 /ganslate RUN mkdir /data && chmod 777 /data -USER runner +USER ganslate_user + +WORKDIR /home/ganslate_user + +# Install the ganslate package #TODO: Replace with final package link +RUN pip install --no-warn-script-location -i https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple ganslate==0.1.4 -WORKDIR /ganslate +# Script are installed in ~/.local/bin, add it to PATH +ENV PATH "~/.local/bin:$PATH" -ENTRYPOINT $0 $@ +ENTRYPOINT /bin/bash