diff --git a/tools/dockerfiles/bionic.tf-r1.14.otb-develop/Dockerfile b/tools/dockerfiles/bionic.tf-r1.14.otb-develop/Dockerfile index cf39a7897c2f79f9f4f4703521699a3d59bc9ec1..e5c0d380090efb71fd70c2ffc832d9e6bb472af4 100644 --- a/tools/dockerfiles/bionic.tf-r1.14.otb-develop/Dockerfile +++ b/tools/dockerfiles/bionic.tf-r1.14.otb-develop/Dockerfile @@ -62,17 +62,20 @@ RUN apt-get update -y \ qttools5-dev \ default-jdk \ python3-pip \ - python3-dev \ - python3-mock \ - python3-numpy \ - python3-gdal \ + python3.6-dev \ + python3.6-gdal \ python3-setuptools \ libxmu-dev \ libxi-dev \ qttools5-dev-tools \ - && rm -rf /var/lib/apt/lists/* \ - && ln -s /usr/bin/python3 /usr/bin/python \ - && pip3 install pip six numpy wheel mock keras future + && rm -rf /var/lib/apt/lists/* + +# ---------------------------------------------------------------------------- +# Python packages +# ---------------------------------------------------------------------------- +RUN ln -s /usr/bin/python3 /usr/bin/python \ + && python3 -m pip install --upgrade pip \ + && python3 -m pip install pip six numpy wheel mock keras future # ---------------------------------------------------------------------------- # Build TensorFlow @@ -82,36 +85,45 @@ RUN export TF_ROOT=/work/tf \ && cd ${TF_ROOT}/bazel \ && wget https://github.com/bazelbuild/bazel/releases/download/0.24.1/bazel-0.24.1-installer-linux-x86_64.sh \ && chmod +x bazel-0.24.1-installer-linux-x86_64.sh \ - && ./bazel-0.24.1-installer-linux-x86_64.sh \ + && ./bazel-0.24.1-installer-linux-x86_64.sh + +RUN export TF_ROOT=/work/tf \ && export PATH="$PATH:$HOME/bin" \ && cd $TF_ROOT \ && git clone https://github.com/tensorflow/tensorflow.git \ && cd tensorflow \ && git checkout r1.14 \ && echo "\n\n\n\n\n\n\n\n\n" | ./configure \ - && bazel build //tensorflow:libtensorflow_framework.so //tensorflow:libtensorflow_cc.so //tensorflow/tools/pip_package:build_pip_package \ + && bazel build //tensorflow:libtensorflow_framework.so //tensorflow:libtensorflow_cc.so //tensorflow/tools/pip_package:build_pip_package + +RUN export TF_ROOT=/work/tf \ + && cd $TF_ROOT/tensorflow \ && bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg \ && pip3 install $(find /tmp/tensorflow_pkg/ -type f -iname "tensorflow*.whl") \ && ./tensorflow/contrib/makefile/build_all_linux.sh \ && mkdir -p /work/tf/installdir/lib \ && mkdir -p /work/tf/installdir/include \ - && cp -v bazel-bin/tensorflow/libtensorflow_cc.so /work/tf/installdir/lib \ - && cp -v bazel-bin/tensorflow/libtensorflow_framework.so /work/tf/installdir/lib \ - && cp -v tensorflow/contrib/makefile/gen/protobuf/lib/libprotobuf.a /work/tf/installdir/lib \ - && cp -v tensorflow/contrib/makefile/downloads/nsync/builds/default.linux.c++11/*.a /work/tf/installdir/lib \ - && cp -rv bazel-genfiles/* /work/tf/installdir/include/ \ - && cp -rv tensorflow/cc /work/tf/installdir/include/tensorflow/ \ - && cp -rv tensorflow/core /work/tf/installdir/include/tensorflow/ \ - && cp -rv third_party /work/tf/installdir/include/ \ - && cp -rv tensorflow/contrib/makefile/gen/protobuf/include/* /work/tf/installdir/include/ \ - && cp -rv tensorflow/contrib/makefile/downloads/eigen/Eigen /work/tf/installdir/include/ \ - && cp -rv tensorflow/contrib/makefile/downloads/eigen/unsupported /work/tf/installdir/include/ \ - && cp -rv tensorflow/contrib/makefile/downloads/eigen/signature_of_eigen3_matrix_library /work/tf/installdir/include/ \ + && cp bazel-bin/tensorflow/libtensorflow_cc.so /work/tf/installdir/lib \ + && cp bazel-bin/tensorflow/libtensorflow_framework.so /work/tf/installdir/lib \ + && cp tensorflow/contrib/makefile/gen/protobuf/lib/libprotobuf.a /work/tf/installdir/lib \ + && cp tensorflow/contrib/makefile/downloads/nsync/builds/default.linux.c++11/*.a /work/tf/installdir/lib \ + && cp -r bazel-genfiles/* /work/tf/installdir/include/ \ + && cp -r tensorflow/cc /work/tf/installdir/include/tensorflow/ \ + && cp -r tensorflow/core /work/tf/installdir/include/tensorflow/ \ + && cp -r third_party /work/tf/installdir/include/ \ + && cp -r tensorflow/contrib/makefile/gen/protobuf/include/* /work/tf/installdir/include/ \ + && cp -r tensorflow/contrib/makefile/downloads/eigen/Eigen /work/tf/installdir/include/ \ + && cp -r tensorflow/contrib/makefile/downloads/eigen/unsupported /work/tf/installdir/include/ \ + && cp -r tensorflow/contrib/makefile/downloads/eigen/signature_of_eigen3_matrix_library /work/tf/installdir/include/ \ && cd ${TF_ROOT}/tensorflow/tensorflow/contrib/makefile/downloads/absl \ - && find absl/ -name '*.h' -exec cp --parents \{\} /work/tf/installdir/include/ \; \ - && find absl/ -name '*.inc' -exec cp --parents \{\} /work/tf/installdir/include/ \; \ + && find absl/ -name '*.h' -exec cp --parents \{\} /work/tf/installdir/include/ \; \ + && find absl/ -name '*.inc' -exec cp --parents \{\} /work/tf/installdir/include/ \; \ && find /work/tf/installdir/ -name "*.cc" -type f -delete +RUN echo "Create symlinks for tensorflow libs" \ + && ln -s /work/tf/installdir/lib/libtensorflow_cc.so /work/tf/installdir/lib/libtensorflow_cc.so.1 \ + && ln -s /work/tf/installdir/lib/libtensorflow_framework.so /work/tf/installdir/lib/libtensorflow_framework.so.1 + # ---------------------------------------------------------------------------- # Build OTB # ---------------------------------------------------------------------------- @@ -161,10 +173,6 @@ RUN mkdir -p /work/otb/build \ && cd /work/otb/build/ \ && make -j $(grep -c ^processor /proc/cpuinfo) -RUN echo "Create symlinks for tensorflow libs" \ - && ln -s /work/tf/installdir/lib/libtensorflow_cc.so /work/tf/installdir/lib/libtensorflow_cc.so.1 \ - && ln -s /work/tf/installdir/lib/libtensorflow_framework.so /work/tf/installdir/lib/libtensorflow_framework.so.1 - ENV PATH "$PATH:/work/otb/superbuild_install/bin/" ENV LD_LIBRARY_PATH "$LD_LIBRARY_PATH:/work/otb/superbuild_install/lib/:/work/tf/installdir/lib/" ENV PYTHONPATH "$PYTHONPATH:/work/otb/superbuild_install/lib/otb/python/"