docker-compose.yml 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. version: '3.8'
  2. services:
  3. dots-ocr-server:
  4. image: dots-ocr:latest
  5. container_name: dots-ocr-container
  6. ports:
  7. - "8000:8000"
  8. volumes:
  9. #download model to local,model url:https://www.modelscope.cn/models/rednote-hilab/dots.ocr
  10. - ./model/dots.ocr:/workspace/weights/DotsOCR
  11. environment:
  12. - PYTHONPATH=/workspace/weights:$PYTHONPATH
  13. deploy:
  14. resources:
  15. reservations:
  16. devices:
  17. - capabilities: [gpu]
  18. device_ids: ['0']
  19. entrypoint: /bin/bash
  20. command:
  21. - -c
  22. - |
  23. set -ex;
  24. echo '--- Starting setup and server ---';
  25. echo 'Modifying vllm entrypoint...';
  26. # This sed command patches the vllm entrypoint script to import the custom modeling code.
  27. sed -i '/^from vllm\.entrypoints\.cli\.main import main/a from DotsOCR import modeling_dots_ocr_vllm' $(which vllm) && \
  28. echo 'vllm script after patch:';
  29. # Show the patched part of the vllm script for verification.
  30. grep -A 1 'from vllm.entrypoints.cli.main import main' $(which vllm) && \
  31. echo 'Starting server...';
  32. # Use 'exec' to replace the current shell process with the vllm server,
  33. # ensuring logs are properly forwarded to Docker's standard output.
  34. exec vllm serve /workspace/weights/DotsOCR \
  35. --tensor-parallel-size 1 \
  36. --gpu-memory-utilization 0.8 \
  37. --chat-template-content-format string \
  38. --served-model-name dotsocr-model \
  39. --trust-remote-code