gyang274 / tensorflow-serving-tutorial

A step by step guide on how to use tensorflow serving to serve a tensorflow model.
https://gyang274.github.io/tensorflow-serving-tutorial/
26 stars 12 forks source link

refactor Dockerfile #1

Open david30907d opened 5 years ago

david30907d commented 5 years ago

use official image would make the image size much smaller~

FROM tensorflow/serving:1.11.1

RUN apt-get update \
    && apt-get install -y --no-install-recommends \
    python-numpy \
    python-setuptools \
    python-pip \
    uwsgi-core \
    uwsgi-plugin-python \
    curl \
    && pip install --no-cache-dir tensorflow tensorflow-serving-api grpcio requests \
    && rm -rf /tmp/* /var/cache/apk/* /var/lib/apt/lists/* \
    && apt-get clean

WORKDIR /
# Copy the model servables directory contents into the container at /app
COPY ./scripts/gdrive.sh .
RUN ./gdrive.sh https://drive.google.com/a/smail.nchu.edu.tw/uc\?export\=download\&confirm\=rkYp\&id\=1Xn_nH3OXEEDwi8CMPxHjUR6QbRmxOjHE \
    && tar -zxvf tf_servables.tar.gz \
    && rm tf_servables.tar.gz \
    && mkdir /app \
    && apt-get remove --auto-remove --purge -y curl \
    && mv tf_servables /app/

COPY ./app/slim_unified_client_rest.py /app/slim_unified_client_rest.py
COPY ./app/slim_unified_client_rest.ini /app/slim_unified_client_rest.ini
COPY ./docker-entrypoint.sh .

# Setup EXPOSE
EXPOSE 9000

EXPOSE 80

# Setup ENTRYPOINT
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["server"]
david30907d commented 5 years ago

your original image is about 1.85GB use official image is 1.06GB

gyang274 commented 5 years ago

Thank you!