Skip to content

Commit

Permalink
Issue #1: add containerised build for TFS (not yet tested)
Browse files Browse the repository at this point in the history
  • Loading branch information
ed-alertedh committed May 8, 2018
1 parent 1f1798f commit 4a623c5
Showing 1 changed file with 82 additions and 0 deletions.
82 changes: 82 additions & 0 deletions Dockerfile.model-server
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
#FROM alerte/tensorflow-serving-devel as build-env
## patched build env
FROM ubuntu:16.04 as build-env

RUN apt-get update && apt-get install -y \
build-essential \
curl \
git \
libfreetype6-dev \
libpng12-dev \
libzmq3-dev \
mlocate \
pkg-config \
python-dev \
python-numpy \
python-pip \
software-properties-common \
swig \
zip \
zlib1g-dev \
libcurl3-dev \
openjdk-8-jdk\
openjdk-8-jre-headless \
wget \
&& \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

# Set up grpc

RUN pip install mock grpcio

# Set up Bazel.

ENV BAZELRC /root/.bazelrc
# Install the most recent bazel release.
ENV BAZEL_VERSION 0.13.0
WORKDIR /
RUN mkdir /bazel && \
cd /bazel && \
curl -fSsL -O https://github.com/bazelbuild/bazel/releases/download/$BAZEL_VERSION/bazel-$BAZEL_VERSION-installer-linux-x86_64.sh && \
curl -fSsL -o /bazel/LICENSE.txt https://raw.githubusercontent.com/bazelbuild/bazel/master/LICENSE && \
chmod +x bazel-*.sh && \
./bazel-$BAZEL_VERSION-installer-linux-x86_64.sh && \
cd / && \
rm -f /bazel/bazel-$BAZEL_VERSION-installer-linux-x86_64.sh
## patched build env


COPY . /build_dir
WORKDIR /build_dir
RUN bazel build -c opt //tensorflow_serving/model_servers:tensorflow_model_server

#bazel-bin/tensorflow_serving/model_servers/tensorflow_model_server

FROM ubuntu:xenial

# need to add a PPA for libstdc++6 https://github.com/tensorflow/serving/issues/819
RUN apt-get update
RUN apt-get install -y software-properties-common # if not already installed
RUN add-apt-repository ppa:ubuntu-toolchain-r/test -y

# Install general packages
RUN apt-get update && apt-get install -y \
curl \
libcurl3-dev \
unzip \
wget \
libstdc++6 \
&& \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

# RUN echo "deb [arch=amd64] http://storage.googleapis.com/tensorflow-serving-apt stable tensorflow-model-server tensorflow-model-server-universal" | tee /etc/apt/sources.list.d/tensorflow-serving.list \
# && curl https://storage.googleapis.com/tensorflow-serving-apt/tensorflow-serving.release.pub.gpg | apt-key add - \
# && apt-get update && apt-get install tensorflow-model-server

COPY --from=build-env /build_dir/bazel-bin/tensorflow_serving/model_servers/tensorflow_model_server /usr/bin

ENTRYPOINT ["tensorflow_model_server"]

CMD ["/bin/bash"]

0 comments on commit 4a623c5

Please sign in to comment.