Dockerfile 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. ARG PYTORCH="1.9.0"
  2. ARG CUDA="11.1"
  3. ARG CUDNN="8"
  4. FROM pytorch/pytorch:${PYTORCH}-cuda${CUDA}-cudnn${CUDNN}-devel
  5. ARG MMCV="2.0.0rc4"
  6. ARG MMDET="3.0.0"
  7. ENV PYTHONUNBUFFERED TRUE
  8. # Avoid Public GPG key error
  9. # - https://github.com/NVIDIA/nvidia-docker/issues/1631
  10. RUN rm /etc/apt/sources.list.d/cuda.list \
  11. && rm /etc/apt/sources.list.d/nvidia-ml.list \
  12. && apt-get update \
  13. && apt-get install -y wget \
  14. && rm -rf /var/lib/apt/lists/* \
  15. && apt-key del 7fa2af80 \
  16. && apt-get update && apt-get install -y --no-install-recommends wget \
  17. && wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-keyring_1.0-1_all.deb \
  18. && dpkg -i cuda-keyring_1.0-1_all.deb
  19. # (Optional, use Mirror to speed up downloads)
  20. # RUN sed -i 's/http:\/\/archive.ubuntu.com\/ubuntu\//http:\/\/mirrors.aliyun.com\/ubuntu\//g' /etc/apt/sources.list
  21. # Install the required packages
  22. RUN apt-get update && \
  23. DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \
  24. ca-certificates \
  25. g++ \
  26. openjdk-11-jre-headless \
  27. # MMDet Requirements
  28. ffmpeg libsm6 libxext6 git ninja-build libglib2.0-0 libsm6 libxrender-dev libxext6 \
  29. && rm -rf /var/lib/apt/lists/*
  30. ENV PATH="/opt/conda/bin:$PATH" \
  31. FORCE_CUDA="1"
  32. # TORCHSEVER
  33. RUN pip install torchserve torch-model-archiver nvgpu -i https://pypi.mirrors.ustc.edu.cn/simple/
  34. # MMLAB
  35. ARG PYTORCH
  36. ARG CUDA
  37. RUN pip install mmengine -i https://pypi.mirrors.ustc.edu.cn/simple/
  38. RUN ["/bin/bash", "-c", "pip install mmcv==${MMCV} -f https://download.openmmlab.com/mmcv/dist/cu${CUDA//./}/torch${PYTORCH}/index.html"]
  39. RUN pip install mmdet==${MMDET} -i https://pypi.mirrors.ustc.edu.cn/simple/
  40. RUN useradd -m model-server \
  41. && mkdir -p /home/model-server/tmp
  42. COPY entrypoint.sh /usr/local/bin/entrypoint.sh
  43. RUN chmod +x /usr/local/bin/entrypoint.sh \
  44. && chown -R model-server /home/model-server
  45. COPY config.properties /home/model-server/config.properties
  46. RUN mkdir /home/model-server/model-store && chown -R model-server /home/model-server/model-store
  47. EXPOSE 8080 8081 8082
  48. USER model-server
  49. WORKDIR /home/model-server
  50. ENV TEMP=/home/model-server/tmp
  51. ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
  52. CMD ["serve"]