-
Notifications
You must be signed in to change notification settings - Fork 24
/
Dockerfile
61 lines (48 loc) · 1.88 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
# Base Image is Ubuntu 18.04 with CUDA 11.0
FROM nvidia/cuda:11.0-devel-ubuntu18.04
# Make bash the default shell
SHELL ["/bin/bash", "-c"]
# Install a bunch of useful packages and miniconda
RUN apt-get update && \
apt-get upgrade -y && \
apt-get install -y g++ wget libxrender1 vim git && \
wget --quiet -O ~/miniconda.sh \
https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh && \
chmod +x ~/miniconda.sh && \
~/miniconda.sh -b -p /opt/conda && \
rm ~/miniconda.sh
# add conda to environment path variable
ENV PATH /opt/conda/bin:$PATH
# create a custom bashrc that is run even for non-interactive shells
# also explicitly source from all standard bash config files
RUN touch /etc/bashrc_custom && \
conda init bash && \
awk '/# >>> conda initialize >>>/,/# <<< conda initialize <<</' ~/.bashrc \
>> /etc/bashrc_custom && \
echo -e "\numask 002\n" >> /etc/bashrc_custom && \
echo -e "\nsource /etc/bashrc_custom\n" >> /etc/bash.bashrc && \
echo -e "\nsource /etc/bashrc_custom\n" >> /etc/profile && \
echo -e "\nsource /etc/bashrc_custom\n" >> /root/.bashrc
# tell bash to source the custom bashrc when a shell is started
ENV BASH_ENV /etc/bashrc_custom
# Ensure that GPUs are not visible by default
ENV NVIDIA_VISIBLE_DEVICES none
# Copy source files and requirements file
COPY ./src /src
COPY ./misc /misc
COPY ./paper /paper
COPY ./misc/requirements.txt /misc/requirements.txt
# Install the required packages
# also include headless opencv
RUN conda install -y pip python=3.8 && \
pip install -r misc/requirements.txt opencv-python-headless
# Workdir is the root directory
WORKDIR /
# Declare data volume
VOLUME /data
# Declare local volume
VOLUME /local
# default entrypoint is an non-interactive, non-login shell
ENTRYPOINT ["/bin/bash", "-c"]
# run some sample commands as default command
CMD ["echo -e 'Hello World'; nvidia-smi"]