Dockerfile-cpu 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. # YOLOv5 🚀 by Ultralytics, GPL-3.0 license
  2. # Builds ultralytics/yolov5:latest-cpu image on DockerHub https://hub.docker.com/r/ultralytics/yolov5
  3. # Image is CPU-optimized for ONNX, OpenVINO and PyTorch YOLOv5 deployments
  4. # Start FROM Ubuntu image https://hub.docker.com/_/ubuntu
  5. FROM ubuntu:20.04
  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. RUN apt update
  10. RUN DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt install -y tzdata
  11. RUN apt install --no-install-recommends -y python3-pip git zip curl htop libgl1-mesa-glx libglib2.0-0 libpython3.8-dev
  12. # RUN alias python=python3
  13. # Install pip packages
  14. COPY requirements.txt .
  15. RUN python3 -m pip install --upgrade pip
  16. RUN pip install --no-cache -r requirements.txt albumentations gsutil notebook \
  17. coremltools onnx onnx-simplifier onnxruntime openvino-dev tensorflow-cpu tensorflowjs \
  18. --extra-index-url https://download.pytorch.org/whl/cpu
  19. # Create working directory
  20. RUN mkdir -p /usr/src/app
  21. WORKDIR /usr/src/app
  22. # Copy contents
  23. COPY . /usr/src/app
  24. RUN git clone https://github.com/ultralytics/yolov5 /usr/src/yolov5
  25. # Usage Examples -------------------------------------------------------------------------------------------------------
  26. # Build and Push
  27. # t=ultralytics/yolov5:latest-cpu && sudo docker build -f utils/docker/Dockerfile-cpu -t $t . && sudo docker push $t
  28. # Pull and Run
  29. # t=ultralytics/yolov5:latest-cpu && sudo docker pull $t && sudo docker run -it --ipc=host -v "$(pwd)"/datasets:/usr/src/datasets $t