Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

Dockerfile-python 2.6 KB

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
  1. # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
  2. # Builds ultralytics/ultralytics:latest-cpu image on DockerHub https://hub.docker.com/r/ultralytics/ultralytics
  3. # Image is CPU-optimized for ONNX, OpenVINO and PyTorch YOLO11 deployments
  4. # Use official Python base image for reproducibility (3.11.10 for export and 3.12.6 for inference)
  5. FROM python:3.11.10-slim-bookworm
  6. # Set environment variables
  7. ENV PYTHONUNBUFFERED=1 \
  8. PYTHONDONTWRITEBYTECODE=1 \
  9. PIP_NO_CACHE_DIR=1 \
  10. PIP_BREAK_SYSTEM_PACKAGES=1
  11. # Downloads to user config dir
  12. ADD https://github.com/ultralytics/assets/releases/download/v0.0.0/Arial.ttf \
  13. https://github.com/ultralytics/assets/releases/download/v0.0.0/Arial.Unicode.ttf \
  14. /root/.config/Ultralytics/
  15. # Install linux packages
  16. # g++ required to build 'tflite_support' and 'lap' packages, libusb-1.0-0 required for 'tflite_support' package
  17. # Java runtime environment (default-jre) required for Sony IMX export
  18. RUN apt-get update && \
  19. apt-get install -y --no-install-recommends \
  20. python3-pip git zip unzip wget curl htop libgl1 libglib2.0-0 libpython3-dev gnupg g++ libusb-1.0-0 default-jre \
  21. && rm -rf /var/lib/apt/lists/*
  22. # Create working directory
  23. WORKDIR /ultralytics
  24. # Copy contents and configure git
  25. COPY . .
  26. RUN sed -i '/^\[http "https:\/\/github\.com\/"\]/,+1d' .git/config
  27. ADD https://github.com/ultralytics/assets/releases/download/v8.3.0/yolo11n.pt .
  28. # Install pip packages
  29. RUN pip install uv
  30. RUN uv pip install --system -e ".[export]" --extra-index-url https://download.pytorch.org/whl/cpu --index-strategy unsafe-best-match
  31. # Need lower version of 'numpy' for Sony IMX export
  32. RUN uv pip install --system numpy==1.26.4
  33. # Run exports to AutoInstall packages
  34. RUN yolo export model=tmp/yolo11n.pt format=edgetpu imgsz=32
  35. RUN yolo export model=tmp/yolo11n.pt format=ncnn imgsz=32
  36. RUN yolo export model=tmp/yolov8n.pt format=imx imgsz=32
  37. RUN uv pip install --system paddlepaddle x2paddle
  38. # Remove extra build files
  39. RUN rm -rf tmp /root/.config/Ultralytics/persistent_cache.json
  40. # Usage Examples -------------------------------------------------------------------------------------------------------
  41. # Build and Push
  42. # t=ultralytics/ultralytics:latest-python && sudo docker build -f docker/Dockerfile-python -t $t . && sudo docker push $t
  43. # Run
  44. # t=ultralytics/ultralytics:latest-python && sudo docker run -it --ipc=host $t
  45. # Pull and Run
  46. # t=ultralytics/ultralytics:latest-python && sudo docker pull $t && sudo docker run -it --ipc=host $t
  47. # Pull and Run with local volume mounted
  48. # t=ultralytics/ultralytics:latest-python && sudo docker pull $t && sudo docker run -it --ipc=host -v "$(pwd)"/shared/datasets:/datasets $t
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...