content: # Copyright 2018 The TensorFlow Authors. All Rights Reserved.
  #
  # Licensed under the Apache License, Version 2.0 (the "License");
  # you may not use this file except in compliance with the License.
  # You may obtain a copy of the License at
  #
  #     http://www.apache.org/licenses/LICENSE-2.0
  #
  # Unless required by applicable law or agreed to in writing, software
  # distributed under the License is distributed on an "AS IS" BASIS,
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  # See the License for the specific language governing permissions and
  # limitations under the License.
  # ============================================================================
  #
  # THIS IS A GENERATED DOCKERFILE.
  #
  # This file was assembled from multiple pieces, whose use is documented
  # below. Please refer to the the TensorFlow dockerfiles documentation for
  # more information. Build args are documented as their default value.
  #
  # Ubuntu-based, Nvidia-GPU-enabled environment for developing changes for TensorFlow.
  #
  # Start from Nvidia's Ubuntu base image with CUDA and CuDNN, with TF development
  # packages.
  # --build-arg UBUNTU_VERSION=16.04
  #    ( no description )
  #
  # Python is required for TensorFlow and other libraries.
  # --build-arg USE_PYTHON_3_NOT_2=True
  #    Install python 3 over Python 2
  #
  # Install the latest version of Bazel and Python development tools.
  #
  # Configure TensorFlow's shell prompt and login tools.
  
  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/
  
  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
  
  RUN apt-get update && apt-get install -y \
      build-essential \
      curl \
      git \
      openjdk-8-jdk \
      ${PYTHON}-dev \
      swig
  
  # Install bazel
  RUN echo "deb [arch=amd64] http://storage.googleapis.com/bazel-apt stable jdk1.8" | tee /etc/apt/sources.list.d/bazel.list && \
      curl https://bazel.build/bazel-release.pub.gpg | apt-key add - && \
      apt-get update && \
      apt-get install -y bazel
  
  COPY bashrc /etc/bash.bashrc
  RUN chmod a+rwx /etc/bash.bashrc
  