-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile
173 lines (139 loc) · 5.38 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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
FROM nvidia/cuda:12.2.2-cudnn8-runtime-ubuntu22.04
# ^ If doing an upgrade, ensure cuda/cudnn versions are supported by the
# Tensorflow versions specified below.
# Version of python to be installed and used
ENV PYTHON_VERSION=3.10
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update --yes && \
apt-get install --yes --no-install-recommends \
git \
ca-certificates \
software-properties-common \
locales \
gcc pkg-config libfreetype6-dev libpng-dev g++ \
pandoc \
sudo \
curl \
libffi-dev \
net-tools \
wget && \
apt-get clean && rm -rf /var/lib/apt/lists/* && \
echo "en_US.UTF-8 UTF-8" > /etc/locale.gen && \
locale-gen
RUN apt-get update && \
apt-get install -y software-properties-common && \
add-apt-repository -y ppa:deadsnakes/ppa && \
apt-get update && \
apt install -y python$PYTHON_VERSION python$PYTHON_VERSION-dev python3-pip python$PYTHON_VERSION-distutils gfortran libopenblas-dev liblapack-dev && \
apt-get clean && rm -rf /var/lib/apt/lists/*
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3 1 && \
update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 1
RUN alias python=/usr/bin/python$PYTHON_VERSION && \
python -m pip install --upgrade pip requests setuptools pipenv && \
rm -r ~/.cache/pip
ENV NB_USER="gpuuser"
ENV UID=999
# If the user is root, home is under /root, not /home/root
RUN if [ "${NB_USER}" = "root" ]; then ln -s /root /home/root; fi
ENV CONDA_DIR=/opt/conda \
SHELL=/bin/bash \
NB_USER="${NB_USER}" \
LC_ALL=en_US.UTF-8 \
LANG=en_US.UTF-8 \
LANGUAGE=en_US.UTF-8 \
HOME="/home/${NB_USER}" \
REQUESTS_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt
RUN echo "auth requisite pam_deny.so" >> /etc/pam.d/su && \
sed -i.bak -e 's/^%admin/#%admin/' /etc/sudoers && \
sed -i.bak -e 's/^%sudo/#%sudo/' /etc/sudoers && \
if [ "${NB_USER}" != "root" ]; then useradd -l -m -s /bin/bash -u $UID $NB_USER; fi && \
mkdir -p "${CONDA_DIR}" && \
chown -R "${NB_USER}" "${CONDA_DIR}" && \
chmod g+w /etc/passwd
USER ${NB_USER}
ENV PATH=/home/$NB_USER/.local/bin:$CONDA_DIR/bin:/usr/bin/python$PYTHON_VERSION:$PATH \
PYTHON_LIB_PATH=$CONDA_DIR/lib/python$PYTHON_VERSION/site-packages
# Install conda and into it python and cuda-nvcc
RUN wget --quiet https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh && \
/bin/bash ~/miniconda.sh -f -b -p $CONDA_DIR && \
rm -rf ~/miniconda.sh && \
conda install -y -q conda-forge::python==$PYTHON_VERSION "nvidia/label/cuda-12.2.2"::cuda-nvcc && \
conda clean --all -y
# Install pip packages into conda's python
RUN python$PYTHON_VERSION -m pip install \
aquirdturtle_collapsible_headings==3.1.0 \
bokeh==2.4.3 \
bioblend==1.1.1 \
biopython==1.81\
bqplot==0.12.39 \
elyra==3.15.0 \
galaxy-ie-helpers==0.2.7 \
jupyter_server==1.24.0 \
jupyterlab==3.6.5 \
jupyterlab-nvdashboard==0.8.0 \
jupyterlab-git==0.41.0 \
jupyterlab-execute-time==2.3.1 \
jupyterlab-kernelspy==3.1.0 \
jupyterlab-system-monitor==0.8.0 \
jupyterlab-topbar==0.6.1 \
jupytext==1.14.7 \
nbclassic==1.0.0 \
nibabel==5.1.0 \
numba==0.57.1 \
onnx==1.15.0 \
onnx-tf==1.10.0 \
onnxruntime==1.16.3 \
opencv-python==4.8.1.78 \
tensorflow-cpu==2.15.0 \
tensorrt==8.6.1 \
tf2onnx==1.16.0 \
skl2onnx==1.14.1 \
scikit-image==0.22.0 \
seaborn==0.12.2 \
voila==0.4.1 && \
rm -r ~/.cache/pip
# Cache the CPU-optimised version of tensorflow
RUN mv $PYTHON_LIB_PATH/tensorflow $PYTHON_LIB_PATH/tensorflow-CPU-cached
# Install GPU version of tensorflow
RUN python$PYTHON_VERSION -m pip install \
tensorflow==2.15.0 \
tensorflow_probability==0.23.0 && \
rm -r ~/.cache/pip
# Cache the GPU version of tensorflow
RUN mv $PYTHON_LIB_PATH/tensorflow $PYTHON_LIB_PATH/tensorflow-GPU-cached
USER root
RUN mkdir -p /home/$NB_USER/.ipython/profile_default/startup/ && \
mkdir -p /import && \
mkdir -p /home/$NB_USER/notebooks/ && \
mkdir -p /home/$NB_USER/usecases/ && \
mkdir -p /home/$NB_USER/elyra/ && \
mkdir -p /home/$NB_USER/data
COPY ./startup.sh /startup.sh
COPY ./get_notebook.py /get_notebook.py
COPY ./galaxy_script_job.py /home/$NB_USER/.ipython/profile_default/startup/00-load.py
COPY ./ipython-profile.py /home/$NB_USER/.ipython/profile_default/startup/01-load.py
COPY ./jupyter_notebook_config.py /home/$NB_USER/.jupyter/
COPY ./*.ipynb /home/$NB_USER/
COPY ./notebooks/*.ipynb /home/$NB_USER/notebooks/
COPY ./usecases/*.ipynb /home/$NB_USER/usecases/
COPY ./elyra/*.* /home/$NB_USER/elyra/
COPY ./data/*.tsv /home/$NB_USER/data/
ENV DEBUG=false \
GALAXY_WEB_PORT=10000 \
NOTEBOOK_PASSWORD=none \
CORS_ORIGIN=none \
DOCKER_PORT=none \
API_KEY=none \
HISTORY_ID=none \
REMOTE_HOST=none \
GALAXY_URL=none
# Put a link of tensorrt in the search path.
ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PYTHON_LIB_PATH/tensorrt_libs/
# We also circumvent the hard-coded v8 vs v7 by symlinks
RUN ln -s $PYTHON_LIB_PATH/tensorrt_libs/libnvinfer_plugin.so.8 $PYTHON_LIB_PATH/tensorrt_libs/libnvinfer_plugin.so.7 && \
ln -s $PYTHON_LIB_PATH/tensorrt_libs/libnvinfer.so.8 $PYTHON_LIB_PATH/tensorrt_libs/libnvinfer.so.7
ENV XLA_FLAGS=--xla_gpu_cuda_data_dir=/opt/conda/
RUN chown -R $NB_USER /home/$NB_USER /import
USER ${NB_USER}
WORKDIR /import
CMD /startup.sh