gyang274/tensorflow-serving-tutorial

refactor Dockerfile

david30907d opened this issue · 2 comments

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"]

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

Thank you!