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.4 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
  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 YOLOv8 deployments
  4. # Use the official Python 3.10 slim-bookworm as base image
  5. FROM python:3.10-slim-bookworm
  6. # Downloads to user config dir
  7. ADD https://ultralytics.com/assets/Arial.ttf https://ultralytics.com/assets/Arial.Unicode.ttf /root/.config/Ultralytics/
  8. # Install linux packages
  9. # g++ required to build 'tflite_support' and 'lap' packages, libusb-1.0-0 required for 'tflite_support' package
  10. RUN apt update \
  11. && apt install --no-install-recommends -y python3-pip git zip curl htop libgl1 libglib2.0-0 libpython3-dev gnupg g++ libusb-1.0-0
  12. # Create working directory
  13. WORKDIR /usr/src/ultralytics
  14. # Copy contents
  15. # COPY . /usr/src/ultralytics # git permission issues inside container
  16. RUN git clone https://github.com/ultralytics/ultralytics -b main /usr/src/ultralytics
  17. ADD https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov8n.pt /usr/src/ultralytics/
  18. # Remove python3.11/EXTERNALLY-MANAGED or use 'pip install --break-system-packages' avoid 'externally-managed-environment' Ubuntu nightly error
  19. # RUN rm -rf /usr/lib/python3.11/EXTERNALLY-MANAGED
  20. # Install pip packages
  21. RUN python3 -m pip install --upgrade pip wheel
  22. RUN pip install --no-cache -e ".[export]" --extra-index-url https://download.pytorch.org/whl/cpu
  23. # Run exports to AutoInstall packages
  24. RUN yolo export model=tmp/yolov8n.pt format=edgetpu imgsz=32
  25. RUN yolo export model=tmp/yolov8n.pt format=ncnn imgsz=32
  26. # Requires <= Python 3.10, bug with paddlepaddle==2.5.0 https://github.com/PaddlePaddle/X2Paddle/issues/991
  27. RUN pip install --no-cache paddlepaddle==2.4.2 x2paddle
  28. # Remove exported models
  29. RUN rm -rf tmp
  30. # Usage Examples -------------------------------------------------------------------------------------------------------
  31. # Build and Push
  32. # t=ultralytics/ultralytics:latest-python && sudo docker build -f docker/Dockerfile-python -t $t . && sudo docker push $t
  33. # Run
  34. # t=ultralytics/ultralytics:latest-python && sudo docker run -it --ipc=host $t
  35. # Pull and Run
  36. # t=ultralytics/ultralytics:latest-python && sudo docker pull $t && sudo docker run -it --ipc=host $t
  37. # Pull and Run with local volume mounted
  38. # t=ultralytics/ultralytics:latest-python && sudo docker pull $t && sudo docker run -it --ipc=host -v "$(pwd)"/datasets:/usr/src/datasets $t
Tip!

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

Comments

Loading...