1# Copyright 2019 The TensorFlow Authors. All Rights Reserved. 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# http://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14# ============================================================================ 15# 16# THIS IS A GENERATED DOCKERFILE. 17# 18# This file was assembled from multiple pieces, whose use is documented 19# throughout. Please refer to the TensorFlow dockerfiles documentation 20# for more information. 21 22ARG UBUNTU_VERSION=20.04 23 24FROM ubuntu:${UBUNTU_VERSION} AS base 25 26ARG DEBIAN_FRONTEND="noninteractive" 27 28RUN apt-get update && apt-get install -y --no-install-recommends --fix-missing \ 29 build-essential \ 30 curl \ 31 git \ 32 libcurl3-dev \ 33 libfreetype6-dev \ 34 libhdf5-serial-dev \ 35 libzmq3-dev \ 36 pkg-config \ 37 rsync \ 38 software-properties-common \ 39 sudo \ 40 unzip \ 41 zip \ 42 zlib1g-dev \ 43 openjdk-8-jdk \ 44 openjdk-8-jre-headless \ 45 && \ 46 apt-get clean && \ 47 rm -rf /var/lib/apt/lists/* 48 49ENV CI_BUILD_PYTHON python 50 51# CACHE_STOP is used to rerun future commands, otherwise cloning tensorflow will be cached and will not pull the most recent version 52ARG CACHE_STOP=1 53# Check out TensorFlow source code if --build-arg CHECKOUT_TF_SRC=1 54ARG CHECKOUT_TF_SRC=0 55ARG TF_BRANCH=master 56RUN test "${CHECKOUT_TF_SRC}" -eq 1 && git clone https://github.com/tensorflow/tensorflow.git --branch "${TF_BRANCH}" --single-branch /tensorflow_src || true 57 58# See http://bugs.python.org/issue19846 59ENV LANG C.UTF-8 60ARG PYTHON=python3 61 62RUN apt-get update && apt-get install -y --no-install-recommends --fix-missing \ 63 ca-certificates \ 64 curl \ 65 ${PYTHON} \ 66 ${PYTHON}-distutils 67 68RUN curl -fSsL https://bootstrap.pypa.io/get-pip.py | ${PYTHON} 69 70RUN ${PYTHON} -m pip --no-cache-dir install --upgrade \ 71 pip \ 72 setuptools 73 74# Some TF tools expect a "python" binary 75RUN ln -sf $(which ${PYTHON}) /usr/local/bin/python && \ 76 ln -sf $(which ${PYTHON}) /usr/local/bin/python3 && \ 77 ln -sf $(which ${PYTHON}) /usr/bin/python && \ 78 ln -sf $(which ${PYTHON}) /usr/bin/python3 79 80RUN apt-get update && apt-get install -y --no-install-recommends --fix-missing \ 81 curl 82 83# Install bazel 84ARG BAZEL_VERSION=3.7.2 85RUN mkdir /bazel && \ 86 curl -fSsL -o /bazel/installer.sh "https://github.com/bazelbuild/bazel/releases/download/${BAZEL_VERSION}/bazel-${BAZEL_VERSION}-installer-linux-x86_64.sh" && \ 87 curl -fSsL -o /bazel/LICENSE.txt "https://raw.githubusercontent.com/bazelbuild/bazel/master/LICENSE" && \ 88 bash /bazel/installer.sh && \ 89 rm -f /bazel/installer.sh 90 91COPY bashrc /etc/bash.bashrc 92RUN chmod a+rwx /etc/bash.bashrc 93