glenn-jocher commited on
Commit
918d7b2
β€’
1 Parent(s): b77c8d9

Refactor Dockerfiles to `utils/docker` (#7510)

Browse files

* Refactor Docker files

* Refactor Docker files

* Update Dockerfile

.dockerignore β†’ utils/docker/.dockerignore RENAMED
File without changes
Dockerfile β†’ utils/docker/Dockerfile RENAMED
@@ -23,11 +23,10 @@ COPY . /usr/src/app
23
  RUN git clone https://github.com/ultralytics/yolov5 /usr/src/yolov5
24
 
25
  # Downloads to user config dir
26
- ADD https://ultralytics.com/assets/Arial.ttf /root/.config/Ultralytics/
27
 
28
  # Set environment variables
29
  ENV OMP_NUM_THREADS=8
30
- # ENV HOME=/usr/src/app
31
 
32
 
33
  # Usage Examples -------------------------------------------------------------------------------------------------------
 
23
  RUN git clone https://github.com/ultralytics/yolov5 /usr/src/yolov5
24
 
25
  # Downloads to user config dir
26
+ ADD https://ultralytics.com/assets/Arial.ttf https://ultralytics.com/assets/Arial.Unicode.ttf /root/.config/Ultralytics/
27
 
28
  # Set environment variables
29
  ENV OMP_NUM_THREADS=8
 
30
 
31
 
32
  # Usage Examples -------------------------------------------------------------------------------------------------------
utils/docker/Dockerfile-cpu ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # YOLOv5 πŸš€ by Ultralytics, GPL-3.0 license
2
+
3
+ # Start FROM Ubuntu image https://hub.docker.com/_/ubuntu
4
+ FROM ubuntu:latest
5
+
6
+ # Install linux packages
7
+ RUN apt update
8
+ RUN DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt install -y tzdata
9
+ RUN apt install -y python3-pip git zip curl htop screen libgl1-mesa-glx libglib2.0-0
10
+ RUN alias python=python3
11
+
12
+ # Install python dependencies
13
+ COPY requirements.txt .
14
+ RUN python3 -m pip install --upgrade pip
15
+ RUN pip install --no-cache -r requirements.txt albumentations gsutil notebook \
16
+ coremltools onnx onnx-simplifier onnxruntime openvino-dev tensorflow-cpu tensorflowjs \
17
+ torch==1.11.0+cpu torchvision==0.12.0+cpu -f https://download.pytorch.org/whl/cpu/torch_stable.html
18
+
19
+ # Create working directory
20
+ RUN mkdir -p /usr/src/app
21
+ WORKDIR /usr/src/app
22
+
23
+ # Copy contents
24
+ COPY . /usr/src/app
25
+ RUN git clone https://github.com/ultralytics/yolov5 /usr/src/yolov5
26
+
27
+ # Downloads to user config dir
28
+ ADD https://ultralytics.com/assets/Arial.ttf https://ultralytics.com/assets/Arial.Unicode.ttf /root/.config/Ultralytics/
29
+
30
+
31
+ # Usage Examples -------------------------------------------------------------------------------------------------------
32
+
33
+ # Build and Push
34
+ # t=ultralytics/yolov5:latest-cpu && sudo docker build -t $t . && sudo docker push $t
35
+
36
+ # Pull and Run
37
+ # t=ultralytics/yolov5:latest-cpu && sudo docker pull $t && sudo docker run -it --ipc=host -v "$(pwd)"/datasets:/usr/src/datasets $t