The Dockerfile has a Tensorflow Serving base image. In the same directory as this Dockerfile, we have the saved model in a directory called basic_model. For demonstration, we will avoid some of the Docker best practices.

FROM tensorflow/serving
#
ENV MODEL_BASE_PATH=/models
ENV MODEL_NAME=basic_model
#
COPY basic_model /models/basic_model
#
RUN echo '#!/bin/bash \n\n \
    tensorflow_model_server --port=8500 --rest_api_port=8501 \
    --model_name=${MODEL_NAME} \
    --model_base_path=${MODEL_BASE_PATH}/${MODEL_NAME} \
    "$@"' > /usr/bin/tf_serving_entrypoint.sh \
    && chmod +x /usr/bin/tf_serving_entrypoint.sh
#
ENTRYPOINT ["/usr/bin/tf_serving_entrypoint.sh"]