-
Notifications
You must be signed in to change notification settings - Fork 864
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'staging_0_1_1' into issue_340
- Loading branch information
Showing
31 changed files
with
378 additions
and
127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
include ts/frontend/model-server.jar | ||
include PyPiDescription.rst | ||
include ts/configs/* | ||
include ts/version.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
# syntax = docker/dockerfile:experimental | ||
# | ||
# This file can build images for cpu and gpu env. By default it builds image for CPU. | ||
# Use following option to build image for cuda/GPU: --build-arg BASE_IMAGE=nvidia/cuda:10.1-cudnn7-runtime-ubuntu18.04 | ||
# Here is complete command for GPU/cuda - | ||
# $ DOCKER_BUILDKIT=1 docker build --file Dockerfile --build-arg BASE_IMAGE=nvidia/cuda:10.1-cudnn7-runtime-ubuntu18.04 -t torchserve:latest . | ||
# | ||
# Following comments have been shamelessly copied from https://github.com/pytorch/pytorch/blob/master/Dockerfile | ||
# | ||
# NOTE: To build this you will need a docker version > 18.06 with | ||
# experimental enabled and DOCKER_BUILDKIT=1 | ||
# | ||
# If you do not use buildkit you are not going to have a good time | ||
# | ||
# For reference: | ||
# https://docs.docker.com/develop/develop-images/build_enhancements/ | ||
|
||
|
||
ARG BASE_IMAGE=ubuntu:18.04 | ||
|
||
FROM ${BASE_IMAGE} AS compile-image | ||
|
||
ENV PYTHONUNBUFFERED TRUE | ||
|
||
RUN --mount=type=cache,id=apt-dev,target=/var/cache/apt \ | ||
apt-get update && \ | ||
DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \ | ||
ca-certificates \ | ||
g++ \ | ||
python3-dev \ | ||
python3-distutils \ | ||
python3-venv \ | ||
openjdk-11-jre-headless \ | ||
curl \ | ||
&& rm -rf /var/lib/apt/lists/* \ | ||
&& cd /tmp \ | ||
&& curl -O https://bootstrap.pypa.io/get-pip.py \ | ||
&& python3 get-pip.py | ||
|
||
RUN python3 -m venv /home/venv | ||
|
||
ENV PATH="/home/venv/bin:$PATH" | ||
|
||
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3 1 | ||
RUN update-alternatives --install /usr/local/bin/pip pip /usr/local/bin/pip3 1 | ||
|
||
# This is only useful for cuda env | ||
RUN export USE_CUDA=1 | ||
|
||
RUN pip install --no-cache-dir torch torchvision torchtext torchserve torch-model-archiver | ||
|
||
# Final image for production | ||
FROM ${BASE_IMAGE} AS runtime-image | ||
|
||
ENV PYTHONUNBUFFERED TRUE | ||
|
||
RUN --mount=type=cache,target=/var/cache/apt \ | ||
apt-get update && \ | ||
DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \ | ||
python3 \ | ||
openjdk-11-jre-headless \ | ||
&& rm -rf /var/lib/apt/lists/* \ | ||
&& cd /tmp | ||
|
||
COPY --from=compile-image /home/venv /home/venv | ||
|
||
ENV PATH="/home/venv/bin:$PATH" | ||
|
||
RUN useradd -m model-server \ | ||
&& mkdir -p /home/model-server/tmp | ||
|
||
COPY dockerd-entrypoint.sh /usr/local/bin/dockerd-entrypoint.sh | ||
|
||
RUN chmod +x /usr/local/bin/dockerd-entrypoint.sh \ | ||
&& chown -R model-server /home/model-server | ||
|
||
COPY config.properties /home/model-server/config.properties | ||
RUN mkdir /home/model-server/model-store && chown -R model-server /home/model-server/model-store | ||
|
||
EXPOSE 8080 8081 | ||
|
||
USER model-server | ||
WORKDIR /home/model-server | ||
ENV TEMP=/home/model-server/tmp | ||
ENTRYPOINT ["/usr/local/bin/dockerd-entrypoint.sh"] | ||
CMD ["serve"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.