Created
April 15, 2019 01:56
-
-
Save RainJayTsai/e2dc2371324cca8e04b95165b4655068 to your computer and use it in GitHub Desktop.
build tensorflow in docker the image is python:3.6 ( debian )
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
FROM python:3.6 | |
# install bazel | |
# check the bazel version what you want to build tensroflw and change the VERSION | |
# https://www.tensorflow.org/install/source#linux | |
ARG BAZEL_VERSION 0.15.0 | |
ARG TENSORFLOW_VERSION 1.12.0 | |
RUN apt-get update; apt-get install openjdk-8-jdk | |
RUN set -ex && wget https://github.com/bazelbuild/bazel/releases/download/${BAZEL_VERSION}/bazel-${BAZEL_VERSION}-installer-linux-x86_64.sh \ | |
&& chmod +x bazel-${BAZEL_VERSION}-installer-linux-x86_64.sh ./bazel-${BAZEL_VERSION}-installer-linux-x86_64.sh \ | |
&& ./bazel-${BAZEL_VERSION}-installer-linux-x86_64.sh && bazel | |
# install tensorflow dependency | |
RUN apt-get install --no-install-reocmmends python3-dev python3-pip | |
RUN pip install -U --user pip six numpy wheel setuptools mock \ | |
&& pip install -U --user keras_applications==1.0.6 --no-deps \ | |
&& pip install -U --user keras_preprocessing==1.0.5 --no-deps | |
# download tensorflow source code from github | |
WORKDIR /usr/src/build/ | |
RUN git clone https://github.com/tensorflow/tensorflow.git \ | |
&& cd tensorflow \ | |
&& git checkout $TENSORFLOW_VERSION | |
WORKDIR /usr/src/build/tensorflow | |
RUN export \ | |
PYTHON_BIN_PATH=/usr/local/bin/python3.6 \ | |
PYTHON_LIB_PATH=/usr/local/lib/python3.6/site-packages/ \ | |
TF_NEED_JEMALLOC=0 \ | |
TF_NEED_GCP=0 \ | |
TF_NEED_HDFS=0 \ | |
TF_NEED_S3=0 \ | |
TF_ENABLE_XLA=0 \ | |
TF_NEED_GDR=0 \ | |
TF_NEED_VERBS=0 \ | |
TF_NEED_OPENCL=0 \ | |
TF_NEED_CUDA=0 \ | |
TF_NEED_MPI=0 \ | |
&& ./configure \ | |
&& bazel build --config=opt //tensorflow/tools/pip_package:build_pip_package \ | |
&& ./bazel-bin/tensorflow/tools/pip_package/build_pip_package /mnt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
build tensorflow
ref1
ref2
ref3
ref4