From ac628c0d3e4204236e370e399d45f6a15c2966dd Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Sat, 14 Jan 2023 22:17:29 +0100 Subject: [PATCH] Docker layer reorganization 2 (#362) --- docker/Dockerfile | 9 ++++----- docker/Dockerfile-arm64 | 6 ++++-- docker/Dockerfile-cpu | 7 +++---- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 2542ac0..ea2ac78 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -5,15 +5,14 @@ # Start FROM NVIDIA PyTorch image https://ngc.nvidia.com/catalog/containers/nvidia:pytorch FROM nvcr.io/nvidia/pytorch:22.12-py3 +# Downloads to user config dir +ADD https://ultralytics.com/assets/Arial.ttf https://ultralytics.com/assets/Arial.Unicode.ttf /root/.config/Ultralytics/ + # Remove torch nightly and install torch stable RUN rm -rf /opt/pytorch # remove 1.2GB dir RUN pip uninstall -y torchtext torch torchvision -RUN pip cache purge RUN pip install --no-cache torch torchvision -# Downloads to user config dir -ADD https://ultralytics.com/assets/Arial.ttf https://ultralytics.com/assets/Arial.Unicode.ttf /root/.config/Ultralytics/ - # Install linux packages RUN apt update && apt install --no-install-recommends -y zip htop screen libgl1-mesa-glx @@ -36,7 +35,7 @@ ENV OMP_NUM_THREADS=1 # Usage Examples ------------------------------------------------------------------------------------------------------- # Build and Push -# t=ultralytics/ultralytics:latest && sudo docker build -f utils/docker/Dockerfile -t $t . && sudo docker push $t +# t=ultralytics/ultralytics:latest && sudo docker build -f docker/Dockerfile -t $t . && sudo docker push $t # Pull and Run # t=ultralytics/ultralytics:latest && sudo docker pull $t && sudo docker run -it --ipc=host --gpus all $t diff --git a/docker/Dockerfile-arm64 b/docker/Dockerfile-arm64 index 3499c18..fa6ecb8 100644 --- a/docker/Dockerfile-arm64 +++ b/docker/Dockerfile-arm64 @@ -27,8 +27,10 @@ RUN git clone https://github.com/ultralytics/ultralytics /usr/src/ultralytics COPY requirements.txt . RUN python3 -m pip install --upgrade pip wheel RUN pip install --no-cache ultralytics gsutil notebook \ - tensorflow-aarch64 onnx onnx-simplifier onnxruntime coremltools openvino-dev + tensorflow-aarch64 # tensorflowjs \ + # onnx onnx-simplifier onnxruntime \ + # coremltools openvino-dev \ # Cleanup ENV DEBIAN_FRONTEND teletype @@ -37,7 +39,7 @@ ENV DEBIAN_FRONTEND teletype # Usage Examples ------------------------------------------------------------------------------------------------------- # Build and Push -# t=ultralytics/ultralytics:latest-arm64 && sudo docker build --platform linux/arm64 -f utils/docker/Dockerfile-arm64 -t $t . && sudo docker push $t +# t=ultralytics/ultralytics:latest-arm64 && sudo docker build --platform linux/arm64 -f docker/Dockerfile-arm64 -t $t . && sudo docker push $t # Pull and Run # t=ultralytics/ultralytics:latest-arm64 && sudo docker pull $t && sudo docker run -it --ipc=host -v "$(pwd)"/datasets:/usr/src/datasets $t diff --git a/docker/Dockerfile-cpu b/docker/Dockerfile-cpu index 0163db0..c13330a 100644 --- a/docker/Dockerfile-cpu +++ b/docker/Dockerfile-cpu @@ -27,9 +27,8 @@ RUN git clone https://github.com/ultralytics/ultralytics /usr/src/ultralytics COPY requirements.txt . RUN python3 -m pip install --upgrade pip wheel RUN pip install --no-cache ultralytics albumentations gsutil notebook \ - coremltools onnx onnx-simplifier onnxruntime tensorflow-cpu tensorflowjs \ - openvino-dev \ - # tensorflowjs \ + coremltools onnx onnx-simplifier onnxruntime tensorflow-cpu \ + # openvino-dev tensorflowjs \ --extra-index-url https://download.pytorch.org/whl/cpu # Cleanup @@ -39,7 +38,7 @@ ENV DEBIAN_FRONTEND teletype # Usage Examples ------------------------------------------------------------------------------------------------------- # Build and Push -# t=ultralytics/ultralytics:latest-cpu && sudo docker build -f utils/docker/Dockerfile-cpu -t $t . && sudo docker push $t +# t=ultralytics/ultralytics:latest-cpu && sudo docker build -f docker/Dockerfile-cpu -t $t . && sudo docker push $t # Pull and Run # t=ultralytics/ultralytics:latest-cpu && sudo docker pull $t && sudo docker run -it --ipc=host -v "$(pwd)"/datasets:/usr/src/datasets $t