-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
74 lines (60 loc) · 2.2 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
FROM nvidia/cuda:8.0-cudnn6-devel
# Install curl and sudo
RUN apt-get update && apt-get install -y \
curl \
ca-certificates \
sudo \
&& rm -rf /var/lib/apt/lists/*
# Use Tini as the init process with PID 1
RUN curl -Lso /tini https://github.com/krallin/tini/releases/download/v0.14.0/tini \
&& chmod +x /tini
ENTRYPOINT ["/tini", "--"]
# Create a working directory
RUN mkdir /app
RUN mkdir /clevr
WORKDIR /app
# Create a non-root user and switch to it
RUN adduser --disabled-password --gecos '' --shell /bin/bash user \
&& chown -R user:user /app
RUN echo "user ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/90-user
USER user
# Install Git, bzip2, and X11 client
RUN sudo apt-get update && sudo apt-get install -y --no-install-recommends \
git \
bzip2 \
&& sudo rm -rf /var/lib/apt/lists/*
# Install Miniconda
RUN curl -so ~/miniconda.sh https://repo.continuum.io/miniconda/Miniconda3-4.3.14-Linux-x86_64.sh \
&& chmod +x ~/miniconda.sh \
&& ~/miniconda.sh -b -p ~/miniconda \
&& rm ~/miniconda.sh
# Create a Python 3.6 environment
RUN /home/user/miniconda/bin/conda install conda-build \
&& /home/user/miniconda/bin/conda create -y --name pytorch-py36 \
python=3.6.0 numpy pyyaml scipy ipython mkl \
&& /home/user/miniconda/bin/conda clean -ya
ENV PATH=/home/user/miniconda/envs/pytorch-py36/bin:$PATH \
CONDA_DEFAULT_ENV=pytorch-py36 \
CONDA_PREFIX=/home/user/miniconda/envs/pytorch-py36
# CUDA 8.0-specific steps
RUN conda install -y --name pytorch-py36 -c soumith \
magma-cuda80 \
&& conda clean -ya
# Install PyTorch and Torchvision
RUN conda install -y --name pytorch-py36 -c soumith \
pytorch=0.3.0 torchvision=0.2.0 \
&& conda clean -ya
# Install HDF5 Python bindings
RUN conda install -y --name pytorch-py36 \
h5py \
&& conda clean -ya
RUN pip install h5py-cache tqdm
# Install Torchnet, a high-level framework for PyTorch
# RUN pip install git+https://github.com/pytorch/tnt.git@master
# Install Requests, a Python library for making HTTP requests
# RUN conda install -y --name pytorch-py36 requests && conda clean -ya
# Install Graphviz
# RUN conda install -y --name pytorch-py36 graphviz=2.38.0 \
# && conda clean -ya
# Set the default command to python3
CMD ["python3"]