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-cpu 2.5 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
  1. # Ultralytics YOLO 🚀, AGPL-3.0 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. # Start FROM Ubuntu image https://hub.docker.com/_/ubuntu
  5. FROM ubuntu:23.10
  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. RUN apt-get update && \
  18. apt-get install -y --no-install-recommends \
  19. python3-pip git zip unzip wget curl htop libgl1 libglib2.0-0 libpython3-dev gnupg g++ libusb-1.0-0 \
  20. && rm -rf /var/lib/apt/lists/*
  21. # Create working directory
  22. WORKDIR /ultralytics
  23. # Copy contents and configure git
  24. COPY . .
  25. RUN sed -i '/^\[http "https:\/\/github\.com\/"\]/,+1d' .git/config
  26. ADD https://github.com/ultralytics/assets/releases/download/v8.3.0/yolo11n.pt .
  27. # Install pip packages
  28. RUN python3 -m pip install --upgrade pip wheel
  29. RUN pip install -e ".[export]" --extra-index-url https://download.pytorch.org/whl/cpu
  30. # Run exports to AutoInstall packages
  31. RUN yolo export model=tmp/yolo11n.pt format=edgetpu imgsz=32
  32. RUN yolo export model=tmp/yolo11n.pt format=ncnn imgsz=32
  33. # Requires Python<=3.10, bug with paddlepaddle==2.5.0 https://github.com/PaddlePaddle/X2Paddle/issues/991
  34. # RUN pip install "paddlepaddle>=2.6.0" x2paddle
  35. # Creates a symbolic link to make 'python' point to 'python3'
  36. RUN ln -sf /usr/bin/python3 /usr/bin/python
  37. # Remove extra build files
  38. RUN rm -rf tmp /root/.config/Ultralytics/persistent_cache.json
  39. # Usage Examples -------------------------------------------------------------------------------------------------------
  40. # Build and Push
  41. # t=ultralytics/ultralytics:latest-cpu && sudo docker build -f docker/Dockerfile-cpu -t $t . && sudo docker push $t
  42. # Run
  43. # t=ultralytics/ultralytics:latest-cpu && sudo docker run -it --ipc=host --name NAME $t
  44. # Pull and Run
  45. # t=ultralytics/ultralytics:latest-cpu && sudo docker pull $t && sudo docker run -it --ipc=host --name NAME $t
  46. # Pull and Run with local volume mounted
  47. # t=ultralytics/ultralytics:latest-cpu && 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...