Files
dockerfiles/tensorflow-serving/Dockerfile
T
Liu, Jianjun d0e0e9c572 add tensorflow-serving container
Signed-off-by: Liu, Jianjun <jianjun.liu@intel.com>
2019-09-18 14:27:41 +08:00

55 lines
1.7 KiB
Docker

FROM clearlinux:latest AS builder
MAINTAINER jianjun.liu@intel.com
ARG swupd_args
# Move to latest Clear Linux release to ensure
# that the swupd command line arguments are
# correct
RUN swupd update --no-boot-update $swupd_args
# Grab os-release info from the minimal base image so
# that the new content matches the exact OS version
COPY --from=clearlinux/os-core:latest /usr/lib/os-release /
# Install additional content in a target directory
# using the os version from the minimal base
RUN source /os-release && \
mkdir /install_root \
&& swupd os-install -V ${VERSION_ID} \
--path /install_root --statedir /swupd-state \
--bundles=os-core,tensorflow-serving --no-boot-update
# For some Host OS configuration with redirect_dir on,
# extra data are saved on the upper layer when the same
# file exists on different layers. To minimize docker
# image size, remove the overlapped files before copy.
RUN mkdir /os_core_install
COPY --from=clearlinux/os-core:latest / /os_core_install/
RUN cd / && \
find os_core_install | sed -e 's/os_core_install/install_root/' | xargs rm -d &> /dev/null || true
FROM clearlinux/os-core:latest
COPY --from=builder /install_root /
# Expose ports
# gRPC
EXPOSE 8500
# REST
EXPOSE 8501
# Set where models should be stored in the container
ENV MODEL_BASE_PATH=/models
RUN mkdir -p ${MODEL_BASE_PATH}
# The only required piece is the model name in order to differentiate endpoints
ENV MODEL_NAME=model
# Copy the script that runs the model server so we can use environment variables
RUN mkdir -p /usr/local/bin
COPY tf_serving_entrypoint.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/tf_serving_entrypoint.sh
ENTRYPOINT ["tf_serving_entrypoint.sh"]