Add `Dockerfile-runner` for CI actions runner images (#4595)

pull/4594/head^2
Glenn Jocher 1 year ago committed by GitHub
parent 2567b288c9
commit bd96c0846b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      .github/workflows/docker.yaml
  2. 37
      docker/Dockerfile-runner
  3. 2
      tests/test_cuda.py

@ -117,6 +117,9 @@ jobs:
if: github.event_name == 'push' || (github.event.inputs.dockerfile == matrix.dockerfile && github.event.inputs.push == 'true')
run: |
docker push ultralytics/ultralytics:${{ matrix.tags }}
if [[ "${{ matrix.tags }}" == "latest" ]]; then
t=ultralytics/ultralytics:latest-runner && sudo docker build -f docker/Dockerfile-runner -t $t . && sudo docker push $t
fi
- name: Notify on failure
if: github.event_name == 'push' && failure() # do not notify on cancelled() as cancelling is performed by hand

@ -0,0 +1,37 @@
# Ultralytics YOLO 🚀, AGPL-3.0 license
# Builds GitHub actions CI runner image for deployment to DockerHub https://hub.docker.com/r/ultralytics/ultralytics
# Image is CUDA-optimized for YOLOv8 single/multi-GPU training and inference tests
# Start FROM Ultralytics GPU image
FROM ultralytics/ultralytics:latest
# Set the working directory
WORKDIR /actions-runner
# Download and unpack the latest runner
RUN curl -o actions-runner-linux-x64-2.308.0.tar.gz -L https://github.com/actions/runner/releases/download/v2.308.0/actions-runner-linux-x64-2.308.0.tar.gz && \
tar xzf actions-runner-linux-x64-2.308.0.tar.gz && \
rm actions-runner-linux-x64-2.308.0.tar.gz
# Install runner dependencies
ENV RUNNER_ALLOW_RUNASROOT=1
ENV DEBIAN_FRONTEND=noninteractive
RUN ./bin/installdependencies.sh && \
apt-get -y install libicu-dev
# Inline ENTRYPOINT command to configure and start runner with default TOKEN and NAME
ENTRYPOINT sh -c './config.sh --url https://github.com/ultralytics/ultralytics \
--token ${GITHUB_RUNNER_TOKEN:-TOKEN} \
--name ${GITHUB_RUNNER_NAME:-NAME} \
--labels gpu-latest \
--replace && \
./run.sh'
# Usage Examples -------------------------------------------------------------------------------------------------------
# Build and Push
# t=ultralytics/ultralytics:latest-runner && sudo docker build -f docker/Dockerfile-runner -t $t . && sudo docker push $t
# Pull and Run in detached mode with access to GPUs 0 and 1
# t=ultralytics/ultralytics:latest-runner && sudo docker run -d -e GITHUB_RUNNER_TOKEN=TOKEN -e GITHUB_RUNNER_NAME=NAME --ipc=host --gpus '"device=0,1"' $t

@ -27,7 +27,7 @@ def test_checks():
@pytest.mark.skipif(not CUDA_IS_AVAILABLE, reason='CUDA is not available')
def test_train():
device = 0 if CUDA_DEVICE_COUNT < 2 else [0, 1]
device = 0 if CUDA_DEVICE_COUNT == 1 else [0, 1]
YOLO(MODEL).train(data=DATA, imgsz=64, epochs=1, batch=-1, device=device) # also test AutoBatch, requires imgsz>=64

Loading…
Cancel
Save