mirror of
https://github.com/ultralytics/ultralytics.git
synced 2025-09-15 15:48:41 +08:00
Fix Docker git permissions (#14995)
Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>
This commit is contained in:
parent
9f59331854
commit
8bfac796e6
@ -7,7 +7,11 @@ FROM pytorch/pytorch:2.3.1-cuda12.1-cudnn8-runtime
|
||||
|
||||
# Set environment variables
|
||||
# Avoid DDP error "MKL_THREADING_LAYER=INTEL is incompatible with libgomp.so.1 library" https://github.com/pytorch/pytorch/issues/37377
|
||||
ENV MKL_THREADING_LAYER=GNU
|
||||
ENV PYTHONUNBUFFERED=1 \
|
||||
PYTHONDONTWRITEBYTECODE=1 \
|
||||
PIP_NO_CACHE_DIR=1 \
|
||||
PIP_BREAK_SYSTEM_PACKAGES=1 \
|
||||
MKL_THREADING_LAYER=GNU
|
||||
|
||||
# Downloads to user config dir
|
||||
ADD https://github.com/ultralytics/assets/releases/download/v0.0.0/Arial.ttf \
|
||||
@ -27,24 +31,24 @@ RUN apt upgrade --no-install-recommends -y openssl tar
|
||||
# Create working directory
|
||||
WORKDIR /ultralytics
|
||||
|
||||
# Copy contents and assign permissions
|
||||
# Copy contents and configure git
|
||||
COPY . .
|
||||
RUN git remote set-url origin https://github.com/ultralytics/ultralytics.git
|
||||
RUN sed -i '/^\[http "https:\/\/github\.com\/"\]/,+1d' .git/config
|
||||
ADD https://github.com/ultralytics/assets/releases/download/v8.2.0/yolov8n.pt .
|
||||
|
||||
# Install pip packages
|
||||
RUN python3 -m pip install --upgrade pip wheel
|
||||
# Pin TensorRT-cu12==10.1.0 to avoid 10.2.0 bug https://github.com/ultralytics/ultralytics/pull/14239 (note -cu12 must be used)
|
||||
RUN pip install --no-cache-dir -e ".[export]" "tensorrt-cu12==10.1.0" "albumentations>=1.4.6" comet pycocotools
|
||||
RUN pip install -e ".[export]" "tensorrt-cu12==10.1.0" "albumentations>=1.4.6" comet pycocotools
|
||||
|
||||
# Run exports to AutoInstall packages
|
||||
# Edge TPU export fails the first time so is run twice here
|
||||
RUN yolo export model=tmp/yolov8n.pt format=edgetpu imgsz=32 || yolo export model=tmp/yolov8n.pt format=edgetpu imgsz=32
|
||||
RUN yolo export model=tmp/yolov8n.pt format=ncnn imgsz=32
|
||||
# Requires <= Python 3.10, bug with paddlepaddle==2.5.0 https://github.com/PaddlePaddle/X2Paddle/issues/991
|
||||
RUN pip install --no-cache-dir "paddlepaddle>=2.6.0" x2paddle
|
||||
RUN pip install "paddlepaddle>=2.6.0" x2paddle
|
||||
# Fix error: `np.bool` was a deprecated alias for the builtin `bool` segmentation error in Tests
|
||||
RUN pip install --no-cache-dir numpy==1.23.5
|
||||
RUN pip install numpy==1.23.5
|
||||
# Remove exported models
|
||||
RUN rm -rf tmp
|
||||
|
||||
|
||||
@ -6,6 +6,12 @@
|
||||
# Start FROM Debian image for arm64v8 https://hub.docker.com/r/arm64v8/debian (new)
|
||||
FROM arm64v8/debian:bookworm-slim
|
||||
|
||||
# Set environment variables
|
||||
ENV PYTHONUNBUFFERED=1 \
|
||||
PYTHONDONTWRITEBYTECODE=1 \
|
||||
PIP_NO_CACHE_DIR=1 \
|
||||
PIP_BREAK_SYSTEM_PACKAGES=1
|
||||
|
||||
# Downloads to user config dir
|
||||
ADD https://github.com/ultralytics/assets/releases/download/v0.0.0/Arial.ttf \
|
||||
https://github.com/ultralytics/assets/releases/download/v0.0.0/Arial.Unicode.ttf \
|
||||
@ -20,17 +26,14 @@ RUN apt update \
|
||||
# Create working directory
|
||||
WORKDIR /ultralytics
|
||||
|
||||
# Copy contents and assign permissions
|
||||
# Copy contents and configure git
|
||||
COPY . .
|
||||
RUN git remote set-url origin https://github.com/ultralytics/ultralytics.git
|
||||
RUN sed -i '/^\[http "https:\/\/github\.com\/"\]/,+1d' .git/config
|
||||
ADD https://github.com/ultralytics/assets/releases/download/v8.2.0/yolov8n.pt .
|
||||
|
||||
# Remove python3.11/EXTERNALLY-MANAGED to avoid 'externally-managed-environment' issue, Debian 12 Bookworm error
|
||||
RUN rm -rf /usr/lib/python3.11/EXTERNALLY-MANAGED
|
||||
|
||||
# Install pip packages
|
||||
RUN python3 -m pip install --upgrade pip wheel
|
||||
RUN pip install --no-cache-dir -e ".[export]"
|
||||
RUN pip install -e ".[export]"
|
||||
|
||||
# Creates a symbolic link to make 'python' point to 'python3'
|
||||
RUN ln -sf /usr/bin/python3 /usr/bin/python
|
||||
|
||||
@ -5,6 +5,12 @@
|
||||
# Start FROM miniconda3 image https://hub.docker.com/r/continuumio/miniconda3
|
||||
FROM continuumio/miniconda3:latest
|
||||
|
||||
# Set environment variables
|
||||
ENV PYTHONUNBUFFERED=1 \
|
||||
PYTHONDONTWRITEBYTECODE=1 \
|
||||
PIP_NO_CACHE_DIR=1 \
|
||||
PIP_BREAK_SYSTEM_PACKAGES=1
|
||||
|
||||
# Downloads to user config dir
|
||||
ADD https://github.com/ultralytics/assets/releases/download/v0.0.0/Arial.ttf \
|
||||
https://github.com/ultralytics/assets/releases/download/v0.0.0/Arial.Unicode.ttf \
|
||||
|
||||
@ -5,6 +5,12 @@
|
||||
# Start FROM Ubuntu image https://hub.docker.com/_/ubuntu
|
||||
FROM ubuntu:23.10
|
||||
|
||||
# Set environment variables
|
||||
ENV PYTHONUNBUFFERED=1 \
|
||||
PYTHONDONTWRITEBYTECODE=1 \
|
||||
PIP_NO_CACHE_DIR=1 \
|
||||
PIP_BREAK_SYSTEM_PACKAGES=1
|
||||
|
||||
# Downloads to user config dir
|
||||
ADD https://github.com/ultralytics/assets/releases/download/v0.0.0/Arial.ttf \
|
||||
https://github.com/ultralytics/assets/releases/download/v0.0.0/Arial.Unicode.ttf \
|
||||
@ -18,23 +24,20 @@ RUN apt update \
|
||||
# Create working directory
|
||||
WORKDIR /ultralytics
|
||||
|
||||
# Copy contents (previously used git clone to avoid permission errors)
|
||||
# Copy contents and configure git
|
||||
COPY . .
|
||||
RUN git remote set-url origin https://github.com/ultralytics/ultralytics.git
|
||||
RUN sed -i '/^\[http "https:\/\/github\.com\/"\]/,+1d' .git/config
|
||||
ADD https://github.com/ultralytics/assets/releases/download/v8.2.0/yolov8n.pt .
|
||||
|
||||
# Remove python3.11/EXTERNALLY-MANAGED or use 'pip install --break-system-packages' avoid 'externally-managed-environment' Ubuntu nightly error
|
||||
RUN rm -rf /usr/lib/python3.11/EXTERNALLY-MANAGED
|
||||
|
||||
# Install pip packages
|
||||
RUN python3 -m pip install --upgrade pip wheel
|
||||
RUN pip install --no-cache-dir -e ".[export]" --extra-index-url https://download.pytorch.org/whl/cpu
|
||||
RUN pip install -e ".[export]" --extra-index-url https://download.pytorch.org/whl/cpu
|
||||
|
||||
# Run exports to AutoInstall packages
|
||||
RUN yolo export model=tmp/yolov8n.pt format=edgetpu imgsz=32
|
||||
RUN yolo export model=tmp/yolov8n.pt format=ncnn imgsz=32
|
||||
# Requires Python<=3.10, bug with paddlepaddle==2.5.0 https://github.com/PaddlePaddle/X2Paddle/issues/991
|
||||
# RUN pip install --no-cache-dir "paddlepaddle>=2.6.0" x2paddle
|
||||
# RUN pip install "paddlepaddle>=2.6.0" x2paddle
|
||||
# Remove exported models
|
||||
RUN rm -rf tmp
|
||||
|
||||
|
||||
@ -5,6 +5,10 @@
|
||||
# Start FROM https://catalog.ngc.nvidia.com/orgs/nvidia/containers/l4t-cuda
|
||||
FROM nvcr.io/nvidia/l4t-cuda:10.2.460-runtime
|
||||
|
||||
# Set environment variables
|
||||
ENV PYTHONUNBUFFERED=1 \
|
||||
PYTHONDONTWRITEBYTECODE=1
|
||||
|
||||
# Downloads to user config dir
|
||||
ADD https://github.com/ultralytics/assets/releases/download/v0.0.0/Arial.ttf \
|
||||
https://github.com/ultralytics/assets/releases/download/v0.0.0/Arial.Unicode.ttf \
|
||||
@ -26,9 +30,9 @@ RUN ln -s /usr/bin/pip3 /usr/bin/pip
|
||||
# Create working directory
|
||||
WORKDIR /ultralytics
|
||||
|
||||
# Copy contents and assign permissions
|
||||
# Copy contents and configure git
|
||||
COPY . .
|
||||
RUN chown -R root:root .
|
||||
RUN sed -i '/^\[http "https:\/\/github\.com\/"\]/,+1d' .git/config
|
||||
ADD https://github.com/ultralytics/assets/releases/download/v8.2.0/yolov8n.pt .
|
||||
|
||||
# Download onnxruntime-gpu 1.8.0 and tensorrt 8.2.0.6
|
||||
@ -38,12 +42,12 @@ ADD https://forums.developer.nvidia.com/uploads/short-url/hASzFOm9YsJx6VVFrDW1g4
|
||||
|
||||
# Install pip packages
|
||||
RUN python3 -m pip install --upgrade pip wheel
|
||||
RUN pip install --no-cache-dir \
|
||||
RUN pip install \
|
||||
onnxruntime_gpu-1.8.0-cp38-cp38-linux_aarch64.whl \
|
||||
tensorrt-8.2.0.6-cp38-none-linux_aarch64.whl \
|
||||
https://github.com/ultralytics/assets/releases/download/v0.0.0/torch-1.11.0a0+gitbc2c6ed-cp38-cp38-linux_aarch64.whl \
|
||||
https://github.com/ultralytics/assets/releases/download/v0.0.0/torchvision-0.12.0a0+9b5a3fe-cp38-cp38-linux_aarch64.whl
|
||||
RUN pip install --no-cache-dir -e ".[export]"
|
||||
RUN pip install -e ".[export]"
|
||||
RUN rm *.whl
|
||||
|
||||
# Usage Examples -------------------------------------------------------------------------------------------------------
|
||||
|
||||
@ -5,6 +5,12 @@
|
||||
# Start FROM https://catalog.ngc.nvidia.com/orgs/nvidia/containers/l4t-pytorch
|
||||
FROM nvcr.io/nvidia/l4t-pytorch:r35.2.1-pth2.0-py3
|
||||
|
||||
# Set environment variables
|
||||
ENV PYTHONUNBUFFERED=1 \
|
||||
PYTHONDONTWRITEBYTECODE=1 \
|
||||
PIP_NO_CACHE_DIR=1 \
|
||||
PIP_BREAK_SYSTEM_PACKAGES=1
|
||||
|
||||
# Downloads to user config dir
|
||||
ADD https://github.com/ultralytics/assets/releases/download/v0.0.0/Arial.ttf \
|
||||
https://github.com/ultralytics/assets/releases/download/v0.0.0/Arial.Unicode.ttf \
|
||||
@ -20,13 +26,13 @@ RUN apt update \
|
||||
# Create working directory
|
||||
WORKDIR /ultralytics
|
||||
|
||||
# Copy contents and assign permissions
|
||||
# Copy contents and configure git
|
||||
COPY . .
|
||||
RUN git remote set-url origin https://github.com/ultralytics/ultralytics.git
|
||||
RUN sed -i '/^\[http "https:\/\/github\.com\/"\]/,+1d' .git/config
|
||||
ADD https://github.com/ultralytics/assets/releases/download/v8.2.0/yolov8n.pt .
|
||||
|
||||
# Remove opencv-python from Ultralytics dependencies as it conflicts with opencv-python installed in base image
|
||||
RUN grep -v "opencv-python" pyproject.toml > temp.toml && mv temp.toml pyproject.toml
|
||||
RUN sed -i '/opencv-python/d' pyproject.toml
|
||||
|
||||
# Download onnxruntime-gpu 1.15.1 for Jetson Linux 35.2.1 (JetPack 5.1). Other versions can be seen in https://elinux.org/Jetson_Zoo#ONNX_Runtime
|
||||
ADD https://nvidia.box.com/shared/static/mvdcltm9ewdy2d5nurkiqorofz1s53ww.whl onnxruntime_gpu-1.15.1-cp38-cp38-linux_aarch64.whl
|
||||
@ -34,7 +40,7 @@ ADD https://nvidia.box.com/shared/static/mvdcltm9ewdy2d5nurkiqorofz1s53ww.whl on
|
||||
# Install pip packages manually for TensorRT compatibility https://github.com/NVIDIA/TensorRT/issues/2567
|
||||
RUN python3 -m pip install --upgrade pip wheel
|
||||
RUN pip install onnxruntime_gpu-1.15.1-cp38-cp38-linux_aarch64.whl
|
||||
RUN pip install --no-cache-dir -e ".[export]"
|
||||
RUN pip install -e ".[export]"
|
||||
RUN rm *.whl
|
||||
|
||||
|
||||
|
||||
@ -5,6 +5,12 @@
|
||||
# Start FROM https://catalog.ngc.nvidia.com/orgs/nvidia/containers/l4t-jetpack
|
||||
FROM nvcr.io/nvidia/l4t-jetpack:r36.3.0
|
||||
|
||||
# Set environment variables
|
||||
ENV PYTHONUNBUFFERED=1 \
|
||||
PYTHONDONTWRITEBYTECODE=1 \
|
||||
PIP_NO_CACHE_DIR=1 \
|
||||
PIP_BREAK_SYSTEM_PACKAGES=1
|
||||
|
||||
# Downloads to user config dir
|
||||
ADD https://github.com/ultralytics/assets/releases/download/v0.0.0/Arial.ttf \
|
||||
https://github.com/ultralytics/assets/releases/download/v0.0.0/Arial.Unicode.ttf \
|
||||
@ -17,9 +23,9 @@ RUN apt update && \
|
||||
# Create working directory
|
||||
WORKDIR /ultralytics
|
||||
|
||||
# Copy contents and assign permissions
|
||||
# Copy contents and configure git
|
||||
COPY . .
|
||||
RUN chown -R root:root .
|
||||
RUN sed -i '/^\[http "https:\/\/github\.com\/"\]/,+1d' .git/config
|
||||
ADD https://github.com/ultralytics/assets/releases/download/v8.2.0/yolov8n.pt .
|
||||
|
||||
# Download onnxruntime-gpu 1.18.0 from https://elinux.org/Jetson_Zoo and https://forums.developer.nvidia.com/t/pytorch-for-jetson/72048
|
||||
@ -27,11 +33,11 @@ ADD https://nvidia.box.com/shared/static/48dtuob7meiw6ebgfsfqakc9vse62sg4.whl on
|
||||
|
||||
# Pip install onnxruntime-gpu, torch, torchvision and ultralytics
|
||||
RUN python3 -m pip install --upgrade pip wheel
|
||||
RUN pip install --no-cache-dir \
|
||||
RUN pip install \
|
||||
onnxruntime_gpu-1.18.0-cp310-cp310-linux_aarch64.whl \
|
||||
https://github.com/ultralytics/assets/releases/download/v0.0.0/torch-2.3.0-cp310-cp310-linux_aarch64.whl \
|
||||
https://github.com/ultralytics/assets/releases/download/v0.0.0/torchvision-0.18.0a0+6043bc2-cp310-cp310-linux_aarch64.whl
|
||||
RUN pip install --no-cache-dir -e ".[export]"
|
||||
RUN pip install -e ".[export]"
|
||||
RUN rm *.whl
|
||||
|
||||
# Usage Examples -------------------------------------------------------------------------------------------------------
|
||||
|
||||
@ -5,6 +5,12 @@
|
||||
# Use the official Python 3.10 slim-bookworm as base image
|
||||
FROM python:3.10-slim-bookworm
|
||||
|
||||
# Set environment variables
|
||||
ENV PYTHONUNBUFFERED=1 \
|
||||
PYTHONDONTWRITEBYTECODE=1 \
|
||||
PIP_NO_CACHE_DIR=1 \
|
||||
PIP_BREAK_SYSTEM_PACKAGES=1
|
||||
|
||||
# Downloads to user config dir
|
||||
ADD https://github.com/ultralytics/assets/releases/download/v0.0.0/Arial.ttf \
|
||||
https://github.com/ultralytics/assets/releases/download/v0.0.0/Arial.Unicode.ttf \
|
||||
@ -18,23 +24,20 @@ RUN apt update \
|
||||
# Create working directory
|
||||
WORKDIR /ultralytics
|
||||
|
||||
# Copy contents and assign permissions
|
||||
# Copy contents and configure git
|
||||
COPY . .
|
||||
RUN git remote set-url origin https://github.com/ultralytics/ultralytics.git
|
||||
RUN sed -i '/^\[http "https:\/\/github\.com\/"\]/,+1d' .git/config
|
||||
ADD https://github.com/ultralytics/assets/releases/download/v8.2.0/yolov8n.pt .
|
||||
|
||||
# Remove python3.11/EXTERNALLY-MANAGED or use 'pip install --break-system-packages' avoid 'externally-managed-environment' Ubuntu nightly error
|
||||
# RUN rm -rf /usr/lib/python3.11/EXTERNALLY-MANAGED
|
||||
|
||||
# Install pip packages
|
||||
RUN python3 -m pip install --upgrade pip wheel
|
||||
RUN pip install --no-cache-dir -e ".[export]" --extra-index-url https://download.pytorch.org/whl/cpu
|
||||
RUN pip install -e ".[export]" --extra-index-url https://download.pytorch.org/whl/cpu
|
||||
|
||||
# Run exports to AutoInstall packages
|
||||
RUN yolo export model=tmp/yolov8n.pt format=edgetpu imgsz=32
|
||||
RUN yolo export model=tmp/yolov8n.pt format=ncnn imgsz=32
|
||||
# Requires Python<=3.10, bug with paddlepaddle==2.5.0 https://github.com/PaddlePaddle/X2Paddle/issues/991
|
||||
RUN pip install --no-cache-dir "paddlepaddle>=2.6.0" x2paddle
|
||||
RUN pip install "paddlepaddle>=2.6.0" x2paddle
|
||||
# Remove exported models
|
||||
RUN rm -rf tmp
|
||||
|
||||
|
||||
@ -5,6 +5,14 @@
|
||||
# Start FROM Ultralytics GPU image
|
||||
FROM ultralytics/ultralytics:latest
|
||||
|
||||
# Set environment variables
|
||||
ENV PYTHONUNBUFFERED=1 \
|
||||
PYTHONDONTWRITEBYTECODE=1 \
|
||||
PIP_NO_CACHE_DIR=1 \
|
||||
PIP_BREAK_SYSTEM_PACKAGES=1 \
|
||||
RUNNER_ALLOW_RUNASROOT=1 \
|
||||
DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
# Set the working directory
|
||||
WORKDIR /actions-runner
|
||||
|
||||
@ -15,9 +23,7 @@ RUN FILENAME=actions-runner-linux-x64-2.317.0.tar.gz && \
|
||||
rm $FILENAME
|
||||
|
||||
# Install runner dependencies
|
||||
ENV RUNNER_ALLOW_RUNASROOT=1
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
RUN pip install --no-cache-dir pytest-cov
|
||||
RUN pip install pytest-cov
|
||||
RUN ./bin/installdependencies.sh && \
|
||||
apt-get -y install libicu-dev
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user