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.3 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
  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. # 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 update \
  18. && apt install --no-install-recommends -y python3-pip git zip unzip wget curl htop libgl1 libglib2.0-0 libpython3-dev gnupg g++ libusb-1.0-0
  19. # Create working directory
  20. WORKDIR /ultralytics
  21. # Copy contents and configure git
  22. COPY . .
  23. RUN sed -i '/^\[http "https:\/\/github\.com\/"\]/,+1d' .git/config
  24. ADD https://github.com/ultralytics/assets/releases/download/v8.2.0/yolov8n.pt .
  25. # Install pip packages
  26. RUN python3 -m pip install --upgrade pip wheel
  27. RUN pip install -e ".[export]" --extra-index-url https://download.pytorch.org/whl/cpu
  28. # Run exports to AutoInstall packages
  29. RUN yolo export model=tmp/yolov8n.pt format=edgetpu imgsz=32
  30. RUN yolo export model=tmp/yolov8n.pt format=ncnn imgsz=32
  31. # Requires Python<=3.10, bug with paddlepaddle==2.5.0 https://github.com/PaddlePaddle/X2Paddle/issues/991
  32. RUN pip install "paddlepaddle>=2.6.0" x2paddle
  33. # Remove exported models
  34. RUN rm -rf tmp
  35. # Usage Examples -------------------------------------------------------------------------------------------------------
  36. # Build and Push
  37. # t=ultralytics/ultralytics:latest-python && sudo docker build -f docker/Dockerfile-python -t $t . && sudo docker push $t
  38. # Run
  39. # t=ultralytics/ultralytics:latest-python && sudo docker run -it --ipc=host $t
  40. # Pull and Run
  41. # t=ultralytics/ultralytics:latest-python && sudo docker pull $t && sudo docker run -it --ipc=host $t
  42. # Pull and Run with local volume mounted
  43. # 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...