Skip to content
Snippets Groups Projects
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
Dockerfile 2.79 KiB
# SPDX-License-Identifier: Apache-2.0
FROM git.imp.fu-berlin.de:5000/bioroboticslab/robofish/docker/ubuntu

LABEL maintainer="Moritz Maxeiner <moritz.maxeiner@fu-berlin.de>"
LABEL authors="Moritz Maxeiner <moritz.maxeiner@fu-berlin.de>"

ARG DEBIAN_FRONTEND=noninteractive

RUN apt-get install -y \
        openjdk-11-jdk \
        swig \
        libcurl3-dev \
        libfreetype6-dev \
        libhdf5-serial-dev \
        libzmq3-dev \
        zlib1g-dev \
        && \
    apt-get clean

RUN ln -s /usr/local/cuda/lib64/stubs/libcuda.so /usr/local/cuda/lib64/stubs/libcuda.so.1 && \
    echo "/usr/local/cuda/lib64/stubs" > /etc/ld.so.conf.d/z-cuda-stubs.conf && \
    ldconfig

ARG BAZEL_VERSION=0.26.1
RUN mkdir -p /opt/bazel && \
    wget -O /opt/bazel/installer.sh "https://github.com/bazelbuild/bazel/releases/download/${BAZEL_VERSION}/bazel-${BAZEL_VERSION}-installer-linux-x86_64.sh" && \
    wget -O /opt/bazel/LICENSE.txt "https://raw.githubusercontent.com/bazelbuild/bazel/master/LICENSE" && \
    chmod +x /opt/bazel/installer.sh && \
    /opt/bazel/installer.sh && \
    rm -f /opt/bazel/installer.sh

ARG TF_VERSION=1.15.2
RUN git clone --recursive --branch v${TF_VERSION} https://github.com/tensorflow/tensorflow.git /opt/tensorflow/src

COPY disable-enforced-bazel-build-mirror.patch /opt/tensorflow/patches/disable-enforced-bazel-build-mirror.patch
RUN sed -i '/https:\/\/mirror.bazel.build\/github.com\/pybind\/pybind11\/archive\/v2.3.0.tar.gz/d' /opt/tensorflow/src/tensorflow/workspace.bzl && \
    cd /opt/tensorflow/src && \
    patch -p1 -i /opt/tensorflow/patches/disable-enforced-bazel-build-mirror.patch

RUN mkdir -p /opt/tensorflow/.venv && \
    python3.7 -m venv /opt/tensorflow/.venv/python3.7 && \
    . /opt/tensorflow/.venv/python3.7/bin/activate && \
    pip --no-cache-dir install --upgrade pip && \
    pip --no-cache-dir install wheel && \
    pip --no-cache-dir install \
        Pillow \
        h5py \
        keras_preprocessing \
        matplotlib \
        mock \
        'numpy<1.19.0' \
        scipy \
        sklearn \
        pandas \
        future \
        portpicker

ENV LD_LIBRARY_PATH /usr/local/cuda/extras/CUPTI/lib64:/usr/local/cuda/lib64:/usr/local/cuda/lib64/stubs:/usr/include/x64_64-linux-gnu:$LD_LIBRARY_PATH
ENV TF_NEED_CUDA 1
ENV TF_NEED_TENSORRT 1
ENV TF_CUDA_VERSION=${CUDA}
ENV TF_CUDNN_VERSION=${CUDNN_MAJOR_VERSION}

COPY tf_configure.bazelrc /opt/tensorflow/src/.tf_configure.bazelrc
RUN cd /opt/tensorflow/src && \
    . /opt/tensorflow/.venv/python3.7/bin/activate && \
    bazel build \
        --action_env PYTHONPATH="/opt/tensorflow/.venv/python3.7/lib/python3.7/site-packages" \
        --config=cuda --config=opt --config=mkl \
        //tensorflow/tools/pip_package:build_pip_package && \
    ./bazel-bin/tensorflow/tools/pip_package/build_pip_package /opt/tensorflow/build