Home | History | Annotate | Download | only in linux
      1 #!/usr/bin/env bash
      2 # Copyright 2016 The TensorFlow Authors. All Rights Reserved.
      3 #
      4 # Licensed under the Apache License, Version 2.0 (the "License");
      5 # you may not use this file except in compliance with the License.
      6 # You may obtain a copy of the License at
      7 #
      8 #     http://www.apache.org/licenses/LICENSE-2.0
      9 #
     10 # Unless required by applicable law or agreed to in writing, software
     11 # distributed under the License is distributed on an "AS IS" BASIS,
     12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13 # See the License for the specific language governing permissions and
     14 # limitations under the License.
     15 # ==============================================================================
     16 #
     17 # Script to produce a tarball release of the C-library, Java native library
     18 # and Java .jars.
     19 # Builds a docker container and then builds in said container.
     20 #
     21 # See libtensorflow_cpu.sh and libtensorflow_gpu.sh
     22 
     23 set -ex
     24 SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
     25 DOCKER_CONTEXT_PATH="$(realpath ${SCRIPT_DIR}/..)"
     26 ROOT_DIR="$(realpath ${SCRIPT_DIR}/../../../../)"
     27 
     28 DOCKER_IMAGE="tf-libtensorflow-cpu"
     29 DOCKER_FILE="Dockerfile.cpu"
     30 DOCKER_BINARY="docker"
     31 if [ "${TF_NEED_CUDA}" == "1" ]; then
     32   DOCKER_IMAGE="tf-tensorflow-gpu"
     33   DOCKER_BINARY="nvidia-docker"
     34   DOCKER_FILE="Dockerfile.gpu"
     35 fi
     36 
     37 docker build \
     38   -t "${DOCKER_IMAGE}" \
     39   -f "${DOCKER_CONTEXT_PATH}/${DOCKER_FILE}" \
     40   "${DOCKER_CONTEXT_PATH}"
     41 
     42 ${DOCKER_BINARY} run \
     43   --rm \
     44   --pid=host \
     45   -v ${ROOT_DIR}:/workspace \
     46   -w /workspace \
     47   -e "PYTHON_BIN_PATH=/usr/bin/python" \
     48   -e "TF_NEED_GCP=0" \
     49   -e "TF_NEED_HDFS=0" \
     50   -e "TF_NEED_CUDA=${TF_NEED_CUDA}" \
     51   -e "TF_NEED_OPENCL_SYCL=0" \
     52   "${DOCKER_IMAGE}" \
     53   "/workspace/tensorflow/tools/ci_build/linux/libtensorflow.sh"
     54