Dockerfile 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. ARG PYTORCH="1.8.1"
  2. ARG CUDA="10.2"
  3. ARG CUDNN="7"
  4. FROM pytorch/pytorch:${PYTORCH}-cuda${CUDA}-cudnn${CUDNN}-devel
  5. ARG MMCV="2.0.0rc4"
  6. ARG MMPOSE="1.0.0rc1"
  7. ENV PYTHONUNBUFFERED TRUE
  8. RUN apt-get update && \
  9. DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \
  10. ca-certificates \
  11. g++ \
  12. openjdk-11-jre-headless \
  13. # MMDet Requirements
  14. ffmpeg libsm6 libxext6 git ninja-build libglib2.0-0 libsm6 libxrender-dev libxext6 \
  15. && rm -rf /var/lib/apt/lists/*
  16. ENV PATH="/opt/conda/bin:$PATH"
  17. RUN export FORCE_CUDA=1
  18. # MMLAB
  19. ARG PYTORCH
  20. ARG CUDA
  21. RUN pip install mmengine
  22. RUN ["/bin/bash", "-c", "pip install mmcv==${MMCV}} -f https://download.openmmlab.com/mmcv/dist/cu${CUDA//./}/torch${PYTORCH}/index.html"]
  23. RUN pip install mmpose==${MMPOSE}
  24. # TORCHSEVER
  25. RUN pip install torchserve torch-model-archiver
  26. RUN useradd -m model-server \
  27. && mkdir -p /home/model-server/tmp
  28. COPY entrypoint.sh /usr/local/bin/entrypoint.sh
  29. RUN chmod +x /usr/local/bin/entrypoint.sh \
  30. && chown -R model-server /home/model-server
  31. COPY config.properties /home/model-server/config.properties
  32. RUN mkdir /home/model-server/model-store && chown -R model-server /home/model-server/model-store
  33. EXPOSE 8080 8081 8082
  34. USER model-server
  35. WORKDIR /home/model-server
  36. ENV TEMP=/home/model-server/tmp
  37. ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
  38. CMD ["serve"]