Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
74 lines (59 sloc) 3.04 KB
FROM nvidia/cuda:8.0-cudnn6-runtime-ubuntu16.04
MAINTAINER "Max Woolf"
RUN apt-get update && apt-get install -y wget ca-certificates \
git curl vim python3-dev python3-pip libopencv-dev python-opencv \
libfreetype6-dev libpng12-dev libhdf5-dev openmpi-bin \
pkg-config zip g++ zlib1g-dev unzip build-essential \
openjdk-8-jdk openjdk-8-jre-headless python-dev
RUN pip3 install --upgrade pip
RUN pip3 --no-cache-dir install numpy pandas sklearn matplotlib seaborn jupyter pyyaml h5py ipykernel
# Compile TensorFlow w/ CPU instructions
# https://github.com/tensorflow/tensorflow/blob/master/tensorflow/tools/docker/Dockerfile.devel
RUN echo "startup --batch" >>/etc/bazel.bazelrc
RUN echo "build --spawn_strategy=standalone --genrule_strategy=standalone" \
>>/etc/bazel.bazelrc
ENV BAZEL_VERSION 0.5.4
WORKDIR /
RUN mkdir /bazel && \
cd /bazel && \
curl -H "User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36" -fSsL -O https://github.com/bazelbuild/bazel/releases/download/$BAZEL_VERSION/bazel-$BAZEL_VERSION-installer-linux-x86_64.sh && \
curl -H "User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36" -fSsL -o /bazel/LICENSE.txt https://raw.githubusercontent.com/bazelbuild/bazel/master/LICENSE && \
chmod +x bazel-*.sh && \
./bazel-$BAZEL_VERSION-installer-linux-x86_64.sh && \
cd / && \
rm -f /bazel/bazel-$BAZEL_VERSION-installer-linux-x86_64.sh
RUN git clone https://github.com/tensorflow/tensorflow.git && \
cd tensorflow && \
git checkout r1.4
WORKDIR /tensorflow
ENV CI_BUILD_PYTHON python3
# Must set bazel commands:
# https://stackoverflow.com/questions/41293077/how-to-compile-tensorflow-with-sse4-2-and-avx-instructions
RUN tensorflow/tools/ci_build/builds/configured CPU \
bazel build -c opt --cxxopt="-D_GLIBCXX_USE_CXX11_ABI=0" \
--copt=-mavx --copt=-mavx2 --copt=-mfma --copt=-mfpmath=both --copt=-msse4.1 --copt=-msse4.2 \
tensorflow/tools/pip_package:build_pip_package && \
bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/pip && \
pip --no-cache-dir install --upgrade /tmp/pip/tensorflow-*.whl && \
rm -rf /tmp/pip && \
rm -rf /root/.cache
# Keras
RUN pip3 install git+https://github.com/fchollet/keras.git
# CNTK
RUN pip3 install https://cntk.ai/PythonWheel/CPU-Only/cntk-2.2-cp35-cp35m-linux_x86_64.whl
# textgenrnn (must be installed after Keras)
# RUN pip3 --no-cache-dir install textgenrnn reactionrnn
# Jupyter and Tensorboard ports
EXPOSE 8888 6006
# https://github.com/tensorflow/tensorflow/blob/master/tensorflow/tools/docker/
COPY jupyter_notebook_config.py /root/.jupyter/
COPY run_jupyter.sh /
# Create folder for Keras i/o
WORKDIR /keras
VOLUME /keras
# Set CNTK backend for Keras
ENV KERAS_BACKEND=cntk
# Set locale to UTF-8 for text:
# https://askubuntu.com/a/601498
RUN apt-get clean && apt-get -y update && apt-get install -y locales && locale-gen en_US.UTF-8
ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' LC_ALL='en_US.UTF-8'