Dockerfile:
FROM ubuntu:18.04 as base_build
ARG TF_SERVING_VERSION_GIT_BRANCH=master
ARG TF_SERVING_VERSION_GIT_COMMIT=head
LABEL tensorflow_serving_github_branchtag=${TF_SERVING_VERSION_GIT_BRANCH}
LABEL tensorflow_serving_github_commit=${TF_SERVING_VERSION_GIT_COMMIT}
RUN apt-get update && apt-get install -y --no-install-recommends \
automake \
build-essential \
ca-certificates \
curl \
git \
libcurl3-dev \
libfreetype6-dev \
libpng-dev \
libtool \
libzmq3-dev \
mlocate \
openjdk-8-jdk\
openjdk-8-jre-headless \
pkg-config \
python-dev \
software-properties-common \
swig \
unzip \
wget \
zip \
zlib1g-dev \
&& \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
RUN curl -fSsL -O https://bootstrap.pypa.io/get-pip.py && \
python get-pip.py && \
rm get-pip.py
RUN pip --no-cache-dir install \
grpcio \
h5py \
keras_applications \
keras_preprocessing \
mock \
numpy \
requests
# setup bazel
RUN apt-get update
RUN apt install gpg-agent -y
RUN apt-get install openjdk-8-jdk -y
RUN echo "deb [arch=amd64] http://storage.googleapis.com/bazel-apt stable jdk1.8" | tee /etc/apt/sources.list.d/bazel.list
RUN curl https://bazel.build/bazel-release.pub.gpg | apt-key add -
RUN apt-get update && apt-get install bazel -y
# Download TF Serving sources (optionally at specific commit).
RUN mkdir -p /tensorflow-serving
WORKDIR /tensorflow-serving
RUN cd /tensorflow-serving && git clone --branch=${TF_SERVING_VERSION_GIT_BRANCH} https://github.com/tensorflow/serving . && \
git remote add upstream https://github.com/tensorflow/serving.git && \
if [ "${TF_SERVING_VERSION_GIT_COMMIT}" != "head" ]; then git checkout ${TF_SERVING_VERSION_GIT_COMMIT} ; fi
FROM base_build as binary_build
# Build, and install TensorFlow Serving
ARG TF_SERVING_BUILD_OPTIONS="--config=mkl --config=nativeopt"
RUN echo "Building with build options: ${TF_SERVING_BUILD_OPTIONS}"
ARG TF_SERVING_BAZEL_OPTIONS=""
RUN echo "Building with Bazel options: ${TF_SERVING_BAZEL_OPTIONS}"
RUN bazel build --color=yes --curses=yes \
${TF_SERVING_BAZEL_OPTIONS} \
--verbose_failures \
--output_filter=DONT_MATCH_ANYTHING \
${TF_SERVING_BUILD_OPTIONS} \
tensorflow_serving/model_servers:tensorflow_model_server && \
cp bazel-bin/tensorflow_serving/model_servers/tensorflow_model_server \
/usr/local/bin/
# Build and install TensorFlow Serving API
RUN bazel build --color=yes --curses=yes \
${TF_SERVING_BAZEL_OPTIONS} \
--verbose_failures \
--output_filter=DONT_MATCH_ANYTHING \
${TF_SERVING_BUILD_OPTIONS} \
tensorflow_serving/tools/pip_package:build_pip_package && \
bazel-bin/tensorflow_serving/tools/pip_package/build_pip_package \
/tmp/pip && \
pip --no-cache-dir install --upgrade /tmp/pip/tensorflow_serving*.whl && \
rm -rf /tmp/pip
# Copy MKL libraries
RUN cp /root/.cache/bazel/_bazel_root/*/external/mkl_linux/lib/* /usr/local/lib
ENV LIBRARY_PATH '/usr/local/lib:$LIBRARY_PATH'
ENV LD_LIBRARY_PATH '/usr/local/lib:$LD_LIBRARY_PATH'
FROM binary_build as clean_build
# Clean up Bazel cache when done.
RUN bazel clean --expunge --color=yes && \
rm -rf /root/.cache
CMD ["/bin/bash"]
Каждый раз, когда я пытаюсь использовать dockerfile для компиляции тензорного потока, я сталкиваюсь со следующей ошибкой
Step 26/33 : RUN bazel build --color=yes --curses=yes ${TF_SERVING_BAZEL_OPTIONS} --verbose_failures --output_filter=DONT_MATCH_ANYTHING ${TF_SERVING_BUILD_OPTIONS} tensorflow_serving/model_servers:tensorflow_model_server && cp bazel-bin/tensorflow_serving/model_servers/tensorflow_model_server /usr/local/bin/
---> Running in 0574b6448779
Extracting Bazel installation...
Starting local Bazel server and connecting to it...
ERROR: error loading package '': in /tensorflow-serving/tensorflow_serving/workspace.bzl: Encountered error while reading extension file 'tensorflow/workspace.bzl': no such package '@org_tensorflow//tensorflow': java.io.IOException: Error downloading [https://mirror.bazel.build/github.com/tensorflow/tensorflow/archive/13c7c20f4fd24fd73275d2ca4306582ac85ce926.tar.gz, https://github.com/tensorflow/tensorflow/archive/13c7c20f4fd24fd73275d2ca4306582ac85ce926.tar.gz] to /root/.cache/bazel/_bazel_root/e53bbb0b0da4e26d24b415310219b953/external/org_tensorflow/13c7c20f4fd24fd73275d2ca4306582ac85ce926.tar.gz: Premature EOF
ERROR: error loading package '': in /tensorflow-serving/tensorflow_serving/workspace.bzl: Encountered error while reading extension file 'tensorflow/workspace.bzl': no such package '@org_tensorflow//tensorflow': java.io.IOException: Error downloading [https://mirror.bazel.build/github.com/tensorflow/tensorflow/archive/13c7c20f4fd24fd73275d2ca4306582ac85ce926.tar.gz, https://github.com/tensorflow/tensorflow/archive/13c7c20f4fd24fd73275d2ca4306582ac85ce926.tar.gz] to /root/.cache/bazel/_bazel_root/e53bbb0b0da4e26d24b415310219b953/external/org_tensorflow/13c7c20f4fd24fd73275d2ca4306582ac85ce926.tar.gz: Premature EOF
INFO: Elapsed time: 366.930s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded)
Fetching @org_tensorflow; fetching 354s
The command '/bin/sh -c bazel build --color=yes --curses=yes ${TF_SERVING_BAZEL_OPTIONS} --verbose_failures --output_filter=DONT_MATCH_ANYTHING ${TF_SERVING_BUILD_OPTIONS} tensorflow_serving/model_servers:tensorflow_model_server && cp bazel-bin/tensorflow_serving/model_servers/tensorflow_model_server /usr/local/bin/' returned a non-zero code: 1
введите описание изображения здесь