Skip to content

Instantly share code, notes, and snippets.

@re4388
Created October 4, 2019 14:21
Show Gist options
  • Save re4388/44376939247930fbcf982d605b4d02fb to your computer and use it in GitHub Desktop.
Save re4388/44376939247930fbcf982d605b4d02fb to your computer and use it in GitHub Desktop.
private_hub/anaconda3/Dockerfile
FROM nvidia/cuda:9.2-cudnn7-devel-ubuntu16.04
ARG PYTHON_VERSION=3.6
ENV LANG=C.UTF-8 LC_ALL=C.UTF-8
ENV PATH /opt/conda/bin:$PATH
# Install basic packages for Ubuntu
RUN apt-get update --fix-missing && apt-get install -y wget bzip2 ca-certificates \
libglib2.0-0 libxext6 libsm6 libxrender1 \
git mercurial subversion && \
# Install basic requirements for PyTorch, see also: pytorch/docker/pytorch/Dockerfile
apt-get install -y --no-install-recommends \
build-essential cmake curl vim libjpeg-dev libpng-dev && \
rm -rf /var/lib/apt/lists/*
# Install Anaconda
RUN wget --quiet https://repo.anaconda.com/archive/Anaconda3-5.2.0-Linux-x86_64.sh -O ~/anaconda.sh && \
/bin/bash ~/anaconda.sh -b -p /opt/conda && \
rm ~/anaconda.sh && \
ln -s /opt/conda/etc/profile.d/conda.sh /etc/profile.d/conda.sh && \
echo ". /opt/conda/etc/profile.d/conda.sh" >> ~/.bashrc && \
echo "conda activate base" >> ~/.bashrc && \
# Install python requirements for PyTorch
/opt/conda/bin/conda install -y python=$PYTHON_VERSION numpy pyyaml scipy ipython mkl mkl-include cython typing && \
/opt/conda/bin/conda clean -ya
# Install PyTorch (cuda92) and other basic requirements
RUN pip install numpy==1.16.2 && \
pip install scipy==1.2.1 && \
pip install pandas==0.24.1 && \
pip install matplotlib==3.0.3 && \
# installing pytorch
pip install torch==1.0.0 && \
pip install torchvision==0.2.1 && \
# installing pytest-cov
pip install -U pytest-cov && \
pip install -U pytest-mock && \
pip install -U "pytest-remotedata>=0.3.1" && \
# installing other requirements
pip install tqdm==4.31.1 && \
pip install pretrainedmodels==0.7.4 && \
pip install albumentations==0.2.3 && \
pip install GPyOpt==1.2.5 && \
pip install Pillow==6.0.0 && \
pip install pydicom==1.2.2 && \
pip install imblearn && \
pip install scikit-multilearn && \
pip install scikit-image==0.14.2 && \
pip install segmentation_models_pytorch && \
pip install efficientnet_pytorch && \
pip install librosa
# Download pretrained model for test (resnet50, resnet101)
RUN python -c "from torch.utils import model_zoo; _ = model_zoo.load_url('https://download.pytorch.org/models/resnet50-19c8e357.pth')" && \
python -c "from torch.utils import model_zoo; _ = model_zoo.load_url('https://download.pytorch.org/models/resnet101-5d3b4d8f.pth')"
# Download dataset for test
RUN python -c "import os; from torchvision import datasets; data_folder = os.path.join('/var', '~data'); \
_ = datasets.CIFAR10(data_folder, download=True); _ = datasets.MNIST(data_folder, download=True); "
# Install Docker CLI for calling pluggable image in this container
RUN curl -fsSLO https://get.docker.com/builds/Linux/x86_64/docker-17.04.0-ce.tgz && \
tar xzvf docker-17.04.0-ce.tgz && \
mv docker/docker usr/local/bin && \
rm -r docker docker-17.04.0-ce.tgz
# Install git LFS
RUN curl -O https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh && \
bash script.deb.sh && apt-get install -y git-lfs && rm script.deb.sh && git lfs install
RUN apt-get install -y curl grep sed dpkg && \
TINI_VERSION=`curl https://github.com/krallin/tini/releases/latest | grep -o "/v.*\"" | sed 's:^..\(.*\).$:\1:'` && \
curl -L "https://github.com/krallin/tini/releases/download/v${TINI_VERSION}/tini_${TINI_VERSION}.deb" > tini.deb && \
dpkg -i tini.deb && \
rm tini.deb && \
apt-get clean
ENTRYPOINT [ "/usr/bin/tini", "--" ]
CMD [ "/bin/bash" ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment