Docker COPY with checkout `fetch-depth: 0` (#4674)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
pull/4682/head
Glenn Jocher 1 year ago committed by GitHub
parent 45ba99973d
commit 4b6147dd6f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      .github/workflows/docker.yaml
  2. 8
      docker/Dockerfile
  3. 4
      docker/Dockerfile-arm64
  4. 6
      docker/Dockerfile-cpu
  5. 4
      docker/Dockerfile-jetson
  6. 6
      docker/Dockerfile-python
  7. 6
      ultralytics/utils/callbacks/tensorboard.py

@ -57,6 +57,8 @@ jobs:
steps: steps:
- name: Checkout repo - name: Checkout repo
uses: actions/checkout@v3 uses: actions/checkout@v3
with:
fetch-depth: 0 # copy full .git directory to access full git history in Docker images
- name: Set up QEMU - name: Set up QEMU
uses: docker/setup-qemu-action@v2 uses: docker/setup-qemu-action@v2

@ -23,8 +23,8 @@ RUN apt upgrade --no-install-recommends -y openssl tar
WORKDIR /usr/src/ultralytics WORKDIR /usr/src/ultralytics
# Copy contents # Copy contents
# COPY . /usr/src/app (issues as not a .git directory) # COPY . /usr/src/ultralytics # git permission issues inside container
RUN git clone https://github.com/ultralytics/ultralytics /usr/src/ultralytics RUN git clone https://github.com/ultralytics/ultralytics -b main /usr/src/ultralytics
ADD https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov8n.pt /usr/src/ultralytics/ ADD https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov8n.pt /usr/src/ultralytics/
# Install pip packages # Install pip packages
@ -34,9 +34,9 @@ RUN pip install --no-cache -e ".[export]" thop albumentations comet pycocotools
# Run exports to AutoInstall packages # Run exports to AutoInstall packages
RUN yolo export model=tmp/yolov8n.pt format=edgetpu imgsz=32 RUN yolo export model=tmp/yolov8n.pt format=edgetpu imgsz=32
RUN yolo export model=tmp/yolov8n.pt format=ncnn imgsz=32 RUN yolo export model=tmp/yolov8n.pt format=ncnn imgsz=32
# Requires <= Python 3.10, bug with paddlepaddle==2.5.0 # Requires <= Python 3.10, bug with paddlepaddle==2.5.0 https://github.com/PaddlePaddle/X2Paddle/issues/991
RUN pip install --no-cache paddlepaddle==2.4.2 x2paddle RUN pip install --no-cache paddlepaddle==2.4.2 x2paddle
# Fix error: `np.bool` was a deprecated alias for the builtin `bool` # Fix error: `np.bool` was a deprecated alias for the builtin `bool` segmentation error in Tests
RUN pip install --no-cache numpy==1.23.5 RUN pip install --no-cache numpy==1.23.5
# Remove exported models # Remove exported models
RUN rm -rf tmp RUN rm -rf tmp

@ -18,8 +18,8 @@ RUN apt update \
WORKDIR /usr/src/ultralytics WORKDIR /usr/src/ultralytics
# Copy contents # Copy contents
# COPY . /usr/src/app (issues as not a .git directory) # COPY . /usr/src/ultralytics # git permission issues inside container
RUN git clone https://github.com/ultralytics/ultralytics /usr/src/ultralytics RUN git clone https://github.com/ultralytics/ultralytics -b main /usr/src/ultralytics
ADD https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov8n.pt /usr/src/ultralytics/ ADD https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov8n.pt /usr/src/ultralytics/
# Install pip packages # Install pip packages

@ -18,8 +18,8 @@ RUN apt update \
WORKDIR /usr/src/ultralytics WORKDIR /usr/src/ultralytics
# Copy contents # Copy contents
COPY . /usr/src/ultralytics # COPY . /usr/src/ultralytics # git permission issues inside container
# RUN git clone https://github.com/ultralytics/ultralytics /usr/src/ultralytics RUN git clone https://github.com/ultralytics/ultralytics -b main /usr/src/ultralytics
ADD https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov8n.pt /usr/src/ultralytics/ ADD https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov8n.pt /usr/src/ultralytics/
# Remove python3.11/EXTERNALLY-MANAGED or use 'pip install --break-system-packages' avoid 'externally-managed-environment' Ubuntu nightly error # Remove python3.11/EXTERNALLY-MANAGED or use 'pip install --break-system-packages' avoid 'externally-managed-environment' Ubuntu nightly error
@ -32,7 +32,7 @@ RUN pip install --no-cache -e ".[export]" thop --extra-index-url https://downloa
# Run exports to AutoInstall packages # Run exports to AutoInstall packages
RUN yolo export model=tmp/yolov8n.pt format=edgetpu imgsz=32 RUN yolo export model=tmp/yolov8n.pt format=edgetpu imgsz=32
RUN yolo export model=tmp/yolov8n.pt format=ncnn imgsz=32 RUN yolo export model=tmp/yolov8n.pt format=ncnn imgsz=32
# Requires <= Python 3.10, bug with paddlepaddle==2.5.0 # Requires <= Python 3.10, bug with paddlepaddle==2.5.0 https://github.com/PaddlePaddle/X2Paddle/issues/991
# RUN pip install --no-cache paddlepaddle==2.4.2 x2paddle # RUN pip install --no-cache paddlepaddle==2.4.2 x2paddle
# Remove exported models # Remove exported models
RUN rm -rf tmp RUN rm -rf tmp

@ -18,8 +18,8 @@ RUN apt update \
WORKDIR /usr/src/ultralytics WORKDIR /usr/src/ultralytics
# Copy contents # Copy contents
# COPY . /usr/src/app (issues as not a .git directory) # COPY . /usr/src/ultralytics # git permission issues inside container
RUN git clone https://github.com/ultralytics/ultralytics /usr/src/ultralytics RUN git clone https://github.com/ultralytics/ultralytics -b main /usr/src/ultralytics
ADD https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov8n.pt /usr/src/ultralytics/ ADD https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov8n.pt /usr/src/ultralytics/
# Remove opencv-python from requirements.txt as it conflicts with opencv-python installed in base image # Remove opencv-python from requirements.txt as it conflicts with opencv-python installed in base image

@ -18,8 +18,8 @@ RUN apt update \
WORKDIR /usr/src/ultralytics WORKDIR /usr/src/ultralytics
# Copy contents # Copy contents
# COPY . /usr/src/app (issues as not a .git directory) # COPY . /usr/src/ultralytics # git permission issues inside container
RUN git clone https://github.com/ultralytics/ultralytics /usr/src/ultralytics RUN git clone https://github.com/ultralytics/ultralytics -b main /usr/src/ultralytics
ADD https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov8n.pt /usr/src/ultralytics/ ADD https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov8n.pt /usr/src/ultralytics/
# Remove python3.11/EXTERNALLY-MANAGED or use 'pip install --break-system-packages' avoid 'externally-managed-environment' Ubuntu nightly error # Remove python3.11/EXTERNALLY-MANAGED or use 'pip install --break-system-packages' avoid 'externally-managed-environment' Ubuntu nightly error
@ -32,7 +32,7 @@ RUN pip install --no-cache -e ".[export]" thop --extra-index-url https://downloa
# Run exports to AutoInstall packages # Run exports to AutoInstall packages
RUN yolo export model=tmp/yolov8n.pt format=edgetpu imgsz=32 RUN yolo export model=tmp/yolov8n.pt format=edgetpu imgsz=32
RUN yolo export model=tmp/yolov8n.pt format=ncnn imgsz=32 RUN yolo export model=tmp/yolov8n.pt format=ncnn imgsz=32
# Requires <= Python 3.10, bug with paddlepaddle==2.5.0 # Requires <= Python 3.10, bug with paddlepaddle==2.5.0 https://github.com/PaddlePaddle/X2Paddle/issues/991
RUN pip install --no-cache paddlepaddle==2.4.2 x2paddle RUN pip install --no-cache paddlepaddle==2.4.2 x2paddle
# Remove exported models # Remove exported models
RUN rm -rf tmp RUN rm -rf tmp

@ -3,11 +3,13 @@
from ultralytics.utils import LOGGER, SETTINGS, TESTS_RUNNING, colorstr from ultralytics.utils import LOGGER, SETTINGS, TESTS_RUNNING, colorstr
try: try:
# WARNING: do not move import due to protobuf issue in https://github.com/ultralytics/ultralytics/pull/4674
from torch.utils.tensorboard import SummaryWriter
assert not TESTS_RUNNING # do not log pytest assert not TESTS_RUNNING # do not log pytest
assert SETTINGS['tensorboard'] is True # verify integration is enabled assert SETTINGS['tensorboard'] is True # verify integration is enabled
from torch.utils.tensorboard import SummaryWriter
# TypeError for handling 'Descriptors cannot not be created directly.' protobuf errors in Windows
except (ImportError, AssertionError, TypeError): except (ImportError, AssertionError, TypeError):
# TypeError for handling 'Descriptors cannot not be created directly.' protobuf errors in Windows
SummaryWriter = None SummaryWriter = None
WRITER = None # TensorBoard SummaryWriter instance WRITER = None # TensorBoard SummaryWriter instance

Loading…
Cancel
Save