forked from the-deep-learners/TensorFlow-LiveLessons
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile-gpu
186 lines (151 loc) · 5.22 KB
/
Dockerfile-gpu
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
174
175
176
177
178
179
180
181
182
183
184
185
186
FROM nvidia/cuda:8.0-cudnn5-devel
MAINTAINER Jon Krohn <[email protected]>
ENV PATH="/usr/local/cuda-8.0/bin:${PATH}"
ENV LD_LIBRARY_PATH="/usr/local/cuda-8.0/lib64:${LD_LIBRARY_PATH}"
## from core/Dockerfile-gpu
# Setup locales
RUN apt-get clean && apt-get update && apt-get install -y locales
RUN locale-gen en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
# Purge existing python installs
RUN apt-get purge -y python.*
# Install prereqs
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential checkinstall \
wget \
bzip2 \
ca-certificates \
sudo \
locales \
fonts-liberation \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
## below mostly from jupyter/minimal-notebook (there's a bit of it in the line above too)
## -- see https://github.com/jupyter/docker-stacks/blob/master/LICENSE.md
# Install Tini
RUN wget --quiet https://github.com/krallin/tini/releases/download/v0.10.0/tini && \
echo "1361527f39190a7338a0b434bd8c88ff7233ce7b9a4876f3315c22fce7eca1b0 *tini" | sha256sum -c - && \
mv tini /usr/local/bin/tini && \
chmod +x /usr/local/bin/tini
# Configure environment
ENV CONDA_DIR /opt/conda
ENV PATH $CONDA_DIR/bin:$PATH
ENV SHELL /bin/bash
ENV NB_USER jovyan
ENV NB_UID 1000
ENV HOME /home/$NB_USER
# Create jovyan user with UID=1000 and in the 'users' group
RUN useradd -m -s /bin/bash -N -u $NB_UID $NB_USER && \
mkdir -p $CONDA_DIR && \
chown $NB_USER $CONDA_DIR
USER $NB_USER
# Setup work directory for backward-compatibility
RUN mkdir /home/$NB_USER/work
# Install conda as jovyan and check the md5 sum provided on the download site
ENV MINICONDA_VERSION 4.3.21
RUN cd /tmp && \
mkdir -p $CONDA_DIR && \
wget --quiet https://repo.continuum.io/miniconda/Miniconda3-${MINICONDA_VERSION}-Linux-x86_64.sh && \
echo "c1c15d3baba15bf50293ae963abef853 *Miniconda3-${MINICONDA_VERSION}-Linux-x86_64.sh" | md5sum -c - && \
/bin/bash Miniconda3-${MINICONDA_VERSION}-Linux-x86_64.sh -f -b -p $CONDA_DIR && \
rm Miniconda3-${MINICONDA_VERSION}-Linux-x86_64.sh && \
$CONDA_DIR/bin/conda config --system --prepend channels conda-forge && \
$CONDA_DIR/bin/conda config --system --set auto_update_conda false && \
$CONDA_DIR/bin/conda config --system --set show_channel_urls true && \
$CONDA_DIR/bin/conda update --all && \
conda clean -tipsy
# Install Jupyter Notebook and Hub
RUN conda install --quiet --yes \
'notebook=5.0.*' \
'jupyterhub=0.7.*' \
'jupyterlab=0.24.*' \
&& conda clean -tipsy
USER root
EXPOSE 8888
WORKDIR $HOME
# Configure container startup
ENTRYPOINT ["tini", "--"]
CMD ["start-notebook.sh"]
# Add local files as late as possible to avoid cache busting
COPY installation/docker-stack-scripts/start.sh /usr/local/bin/
COPY installation/docker-stack-scripts/start-notebook.sh /usr/local/bin/
COPY installation/docker-stack-scripts/start-singleuser.sh /usr/local/bin/
COPY installation/docker-stack-scripts/jupyter_notebook_config.py /etc/jupyter/
RUN chown -R $NB_USER:users /etc/jupyter/
## the next chunk of code is from jupyter/minimal-notebook
# Install all OS dependencies for fully functional notebook server
RUN apt-get update && apt-get install -yq --no-install-recommends \
build-essential \
emacs \
git \
inkscape \
jed \
libsm6 \
libxext-dev \
libxrender1 \
lmodern \
pandoc \
python-dev \
texlive-fonts-extra \
texlive-fonts-recommended \
texlive-generic-recommended \
texlive-latex-base \
texlive-latex-extra \
texlive-xetex \
vim \
unzip \
&& apt-get clean && \
rm -rf /var/lib/apt/lists/*
## the next chunk of code is from jupyter/scipy-notebook
# libav-tools for matplotlib anim
RUN apt-get update && \
apt-get install -y --no-install-recommends libav-tools && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
USER $NB_USER
# Install Python 3 packages
# Remove pyqt and qt pulled in for matplotlib since we're only ever going to
# use notebook-friendly backends in these images
RUN conda install --quiet --yes \
'nomkl' \
'ipywidgets=6.0*' \
'pandas=0.19*' \
'numexpr=2.6*' \
'matplotlib=2.0*' \
'scipy=0.19*' \
'seaborn=0.7*' \
'scikit-learn=0.18*' \
'scikit-image=0.12*' \
'sympy=1.0*' \
'cython=0.25*' \
'patsy=0.4*' \
'statsmodels=0.8*' \
'cloudpickle=0.2*' \
'dill=0.2*' \
'numba=0.31*' \
'bokeh=0.12*' \
'sqlalchemy=1.1*' \
'hdf5=1.8.17' \
'h5py=2.6*' \
'vincent=0.4.*' \
'beautifulsoup4=4.5.*' \
'xlrd' && \
conda remove --quiet --yes --force qt pyqt && \
conda clean -tipsy
# Activate ipywidgets extension in the environment that runs the notebook server
RUN jupyter nbextension enable --py widgetsnbextension --sys-prefix
# Import matplotlib the first time to build the font cache.
ENV XDG_CACHE_HOME /home/$NB_USER/.cache/
RUN MPLBACKEND=Agg python -c "import matplotlib.pyplot"
USER $NB_USER
## Install TensorFlow for GPU
RUN conda install --quiet --yes 'tensorflow-gpu=1.0*'
## Install high-level TensorFlow APIs
RUN pip install tflearn==0.3.2
RUN pip install keras==2.0.8
## Install NLP packages
RUN pip install nltk==3.2.4
RUN pip install gensim==2.3.0
# install Reinforcement Learning packages:
RUN pip install gym==0.9.4