@@ -21,59 +21,58 @@ LABEL maintainer="Abolfazl Shahbazi <abolfazl.shahbazi@intel.com>"
21
21
LABEL tensorflow_serving_github_branchtag=${TF_SERVING_VERSION_GIT_BRANCH}
22
22
LABEL tensorflow_serving_github_commit=${TF_SERVING_VERSION_GIT_COMMIT}
23
23
24
+ ARG DEBIAN_FRONTEND=noninteractive
25
+
26
+ # See http://bugs.python.org/issue19846
27
+ ENV LANG C.UTF-8
28
+ ARG PYTHON=python3
29
+
24
30
RUN apt-get update && apt-get install -y --no-install-recommends \
25
- automake \
26
- build-essential \
27
- ca-certificates \
28
- curl \
29
- git \
30
- libcurl3-dev \
31
- libfreetype6-dev \
32
- libpng-dev \
33
- libtool \
34
- libzmq3-dev \
35
- mlocate \
36
- openjdk-8-jdk\
37
- openjdk-8-jre-headless \
38
- pkg-config \
39
- python-dev \
40
- software-properties-common \
41
- swig \
42
- unzip \
43
- wget \
44
- zip \
45
- zlib1g-dev \
46
- python3-distutils \
47
- && \
31
+ ${PYTHON} \
32
+ ${PYTHON}-dev \
33
+ ${PYTHON}-distutils \
34
+ automake \
35
+ build-essential \
36
+ ca-certificates \
37
+ curl \
38
+ git \
39
+ libcurl3-dev \
40
+ libfreetype6-dev \
41
+ libpng-dev \
42
+ libtool \
43
+ libzmq3-dev \
44
+ mlocate \
45
+ openjdk-8-jdk\
46
+ openjdk-8-jre-headless \
47
+ pkg-config \
48
+ software-properties-common \
49
+ swig \
50
+ unzip \
51
+ wget \
52
+ zip \
53
+ zlib1g-dev \
54
+ && \
48
55
apt-get clean && \
49
56
rm -rf /var/lib/apt/lists/*
50
57
51
- # Install python 3.7.
52
- RUN add-apt-repository ppa:deadsnakes/ppa && \
53
- apt-get update && apt-get install -y \
54
- python3.7 python3.7-dev python3-pip python3.7-venv && \
55
- rm -rf /var/lib/apt/lists/* && \
56
- python3.7 -m pip install pip --upgrade && \
57
- update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 0
58
-
59
- # Make python3.7 the default python version
60
- RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.7 0
58
+ RUN curl -fSsL https://bootstrap.pypa.io/get-pip.py | ${PYTHON}
61
59
62
- RUN curl -fSsL -O https://bootstrap.pypa.io/get-pip.py && \
63
- python3 get-pip.py && \
64
- rm get-pip.py
60
+ # Some TF tools expect a "python" binary
61
+ RUN ln -sf $(which ${PYTHON}) /usr/local/bin/python && \
62
+ ln -sf $(which ${PYTHON}) /usr/local/bin/python3 && \
63
+ ln -sf $(which ${PYTHON}) /usr/bin/python
65
64
66
- RUN pip3 --no-cache-dir install \
67
- future>=0.17.1 \
65
+ RUN python -m pip --no-cache-dir install \
66
+ ' future>=0.17.1' \
68
67
grpcio \
69
68
h5py \
70
- keras_applications>=1.0.8 \
71
- keras_preprocessing>=1.1.0 \
69
+ ' keras_applications>=1.0.8' \
70
+ ' keras_preprocessing>=1.1.0' \
72
71
mock \
73
72
numpy \
74
73
portpicker \
75
74
requests \
76
- --ignore-installed six>=1.12.0
75
+ --ignore-installed ' six>=1.12.0'
77
76
78
77
# Set up Bazel
79
78
ENV BAZEL_VERSION 5.3.0
@@ -89,7 +88,9 @@ RUN mkdir /bazel && \
89
88
90
89
# Download TF Serving sources (optionally at specific commit).
91
90
WORKDIR /tensorflow-serving
92
- RUN curl -sSL --retry 5 https://github.com/tensorflow/serving/tarball/${TF_SERVING_VERSION_GIT_COMMIT} | tar --strip-components=1 -xzf -
91
+ RUN git clone --single-branch --branch=${TF_SERVING_VERSION_GIT_BRANCH} https://github.com/tensorflow/serving /tensorflow-serving && \
92
+ cd /tensorflow-serving && \
93
+ git reset --hard ${TF_SERVING_VERSION_GIT_COMMIT}
93
94
94
95
FROM base_build as binary_build
95
96
# Build, and install TensorFlow Serving
@@ -122,7 +123,7 @@ RUN bazel build --color=yes --curses=yes \
122
123
rm -rf /tmp/pip
123
124
124
125
# Copy openmp libraries
125
- RUN cp /root/.cache/bazel/_bazel_root/*/execroot/tf_serving/bazel-out/k8-opt /bin/external/llvm_openmp/libiomp5.so /usr/local/lib/
126
+ RUN cp -rp /root/.cache/bazel/_bazel_root/*/execroot/tf_serving/bazel-out/host /bin/external/llvm_openmp/libiomp5.so /usr/local/lib/
126
127
127
128
ENV LIBRARY_PATH '/usr/local/lib:$LIBRARY_PATH'
128
129
ENV LD_LIBRARY_PATH '/usr/local/lib:$LD_LIBRARY_PATH'
0 commit comments