Created
May 15, 2019 07:10
-
-
Save saippuakauppias/eac64a0e09ac9e0e45d7a590ed76c87e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ARG UBUNTU_VERSION=16.04 | |
FROM nvidia/cuda:9.0-base-ubuntu${UBUNTU_VERSION} | |
RUN apt-get update && apt-get install -y --no-install-recommends \ | |
build-essential \ | |
cuda-command-line-tools-9-0 \ | |
cuda-cublas-dev-9-0 \ | |
cuda-cudart-dev-9-0 \ | |
cuda-cufft-dev-9-0 \ | |
cuda-curand-dev-9-0 \ | |
cuda-cusolver-dev-9-0 \ | |
cuda-cusparse-dev-9-0 \ | |
curl \ | |
git \ | |
libcudnn7=7.2.1.38-1+cuda9.0 \ | |
libcudnn7-dev=7.2.1.38-1+cuda9.0 \ | |
libnccl2=2.2.13-1+cuda9.0 \ | |
libnccl-dev=2.2.13-1+cuda9.0 \ | |
libcurl3-dev \ | |
libfreetype6-dev \ | |
libhdf5-serial-dev \ | |
libpng12-dev \ | |
libzmq3-dev \ | |
pkg-config \ | |
rsync \ | |
software-properties-common \ | |
unzip \ | |
zip \ | |
zlib1g-dev \ | |
wget \ | |
&& \ | |
rm -rf /var/lib/apt/lists/* && \ | |
find /usr/local/cuda-9.0/lib64/ -type f -name 'lib*_static.a' -not -name 'libcudart_static.a' -delete && \ | |
rm /usr/lib/x86_64-linux-gnu/libcudnn_static_v7.a | |
RUN apt-get update && \ | |
apt-get install nvinfer-runtime-trt-repo-ubuntu1604-4.0.1-ga-cuda9.0 && \ | |
apt-get update && \ | |
apt-get install libnvinfer4=4.1.2-1+cuda9.0 && \ | |
apt-get install libnvinfer-dev=4.1.2-1+cuda9.0 | |
# Link NCCL libray and header where the build script expects them. | |
RUN mkdir /usr/local/cuda-9.0/lib && \ | |
ln -s /usr/lib/x86_64-linux-gnu/libnccl.so.2 /usr/local/cuda/lib/libnccl.so.2 && \ | |
ln -s /usr/include/nccl.h /usr/local/cuda/include/nccl.h | |
# TODO(tobyboyd): Remove after license is excluded from BUILD file. | |
RUN gunzip /usr/share/doc/libnccl2/NCCL-SLA.txt.gz && \ | |
cp /usr/share/doc/libnccl2/NCCL-SLA.txt /usr/local/cuda/ | |
# Configure the build for our CUDA configuration. | |
ENV CI_BUILD_PYTHON python | |
ENV LD_LIBRARY_PATH /usr/local/cuda/extras/CUPTI/lib64:$LD_LIBRARY_PATH | |
ENV TF_NEED_CUDA 1 | |
ENV TF_CUDA_COMPUTE_CAPABILITIES=3.5,5.2,6.0,6.1,7.0 | |
ENV TF_CUDA_VERSION=9.0 | |
ENV TF_CUDNN_VERSION=7 | |
# clone tf | |
RUN git clone https://github.com/tensorflow/tensorflow.git /tensorflow_src | |
ARG USE_PYTHON_3_NOT_2=True | |
ARG _PY_SUFFIX=${USE_PYTHON_3_NOT_2:+3} | |
ARG PYTHON=python${_PY_SUFFIX} | |
ARG PIP=pip${_PY_SUFFIX} | |
# See http://bugs.python.org/issue19846 | |
ENV LANG C.UTF-8 | |
RUN apt-get update && apt-get install -y \ | |
${PYTHON} \ | |
${PYTHON}-pip | |
RUN ${PIP} install --upgrade \ | |
pip \ | |
setuptools | |
# Some TF tools expect a "python" binary | |
RUN ln -s $(which ${PYTHON}) /usr/local/bin/python | |
RUN apt-get update && apt-get install -y \ | |
build-essential \ | |
curl \ | |
git \ | |
wget \ | |
openjdk-8-jdk \ | |
${PYTHON}-dev \ | |
swig | |
RUN ${PIP} --no-cache-dir install \ | |
Pillow \ | |
h5py \ | |
keras_applications \ | |
keras_preprocessing \ | |
matplotlib \ | |
mock \ | |
numpy \ | |
scipy \ | |
sklearn \ | |
pandas \ | |
&& test "${USE_PYTHON_3_NOT_2}" -eq 1 && true || ${PIP} --no-cache-dir install \ | |
enum34 | |
# Install bazel | |
ARG BAZEL_VERSION=0.15.0 | |
RUN mkdir /bazel && \ | |
wget -O /bazel/installer.sh "https://github.com/bazelbuild/bazel/releases/download/${BAZEL_VERSION}/bazel-${BAZEL_VERSION}-installer-linux-x86_64.sh" && \ | |
wget -O /bazel/LICENSE.txt "https://raw.githubusercontent.com/bazelbuild/bazel/master/LICENSE" && \ | |
chmod +x /bazel/installer.sh && \ | |
/bazel/installer.sh && \ | |
rm -f /bazel/installer.sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment