-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
98 lines (81 loc) · 2.91 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# based Dockerfiles links from https://hub.docker.com/r/nvidia/cuda
FROM nvcr.io/nvidia/cuda:11.0-cudnn8-devel-ubuntu18.04
LABEL maintainer "Maciej Aleksandrowicz<[email protected]>"
# ---------------------------------------------------------------------------- #
# CONFIG
ENV \
PYTHON_VERSION="3.8.5" \
CUDNN_LIB_DIR="/usr/local/cuda-11.0/lib64" \
CUDNN_INCLUDE_DIR="/usr/local/cuda-11.0/include" \
DEBIAN_FRONTEND="noninteractive" \
X11VNC_PASSWORD="password" \
TZ="Europe/Warsaw"
EXPOSE 5900 6006 6099 8888
# ---------------------------------------------------------------------------- #
# Utility tools
RUN apt-get update && apt-get install -y --no-install-recommends \
tzdata \
curl \
ca-certificates \
sudo \
git \
bzip2 \
unzip \
libx11-6 \
libomp-dev \
vim \
mc \
tmux \
python-opengl \
xvfb \
x11vnc \
ratpoison \
xterm \
&& rm -rf /var/lib/apt/lists/* /var/cache/apt/*
# ---------------------------------------------------------------------------- #
# Configure timezone
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone \
&& dpkg-reconfigure -f noninteractive tzdata
# ---------------------------------------------------------------------------- #
# Create an user
RUN mkdir /mnt/ws \
&& adduser --disabled-password --gecos '' --shell /bin/bash user \
&& chown -R user:user /mnt/ws \
&& chmod 777 /home/user \
&& echo "user ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/90-user \
&& ln -s /mnt/ws /home/user/ws
USER user
ENV HOME=/home/user
# ---------------------------------------------------------------------------- #
# Miniconda environment
ENV CONDA_AUTO_UPDATE_CONDA=false
ENV PATH=/home/user/miniconda/bin:$PATH
RUN curl -sLo ~/miniconda.sh https://repo.continuum.io/miniconda/Miniconda3-4.7.12.1-Linux-x86_64.sh \
&& chmod +x ~/miniconda.sh \
&& ~/miniconda.sh -b -p ~/miniconda \
&& rm ~/miniconda.sh \
&& conda install -y python==${PYTHON_VERSION} \
&& conda clean -ya
# ---------------------------------------------------------------------------- #
# Pytorch + torchvision + python packages + jupyter-lab
RUN python3 -m pip install torch==1.7.1+cu110 torchvision==0.8.2+cu110 -f https://download.pytorch.org/whl/torch_stable.html
RUN python3 -m pip install \
gym \
&& conda install \
tensorboard \
jupyterlab \
matplotlib \
pandas \
pyyaml \
&& mkdir -p /home/user/.jupyter \
&& (echo "c.NotebookApp.ip = '*'"; echo "c.NotebookApp.notebook_dir = '/mnt/ws'") >> /home/user/.jupyter/jupyter_notebook_config.py \
&& conda clean -ya \
&& rm -r /home/user/.cache/pip
# ---------------------------------------------------------------------------- #
# Entrypoint config
USER root
COPY "container-start.sh" "/opt/container-start.sh"
COPY "xsession-start.sh" "/opt/xsession-start.sh"
RUN chmod +x "/opt/container-start.sh" "/opt/xsession-start.sh"
USER user
CMD ["/opt/container-start.sh"]