Dockerfile-runner 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. # Ultralytics YOLO 🚀, AGPL-3.0 license
  2. # Builds GitHub actions CI runner image for deployment to DockerHub https://hub.docker.com/r/ultralytics/ultralytics
  3. # Image is CUDA-optimized for YOLO11 single/multi-GPU training and inference tests
  4. # Start FROM Ultralytics GPU image
  5. FROM ultralytics/ultralytics:latest
  6. # Set environment variables
  7. ENV PYTHONUNBUFFERED=1 \
  8. PYTHONDONTWRITEBYTECODE=1 \
  9. PIP_NO_CACHE_DIR=1 \
  10. PIP_BREAK_SYSTEM_PACKAGES=1 \
  11. RUNNER_ALLOW_RUNASROOT=1 \
  12. DEBIAN_FRONTEND=noninteractive
  13. # Set the working directory
  14. WORKDIR /actions-runner
  15. # Download and unpack the latest runner from https://github.com/actions/runner
  16. RUN FILENAME=actions-runner-linux-x64-2.320.0.tar.gz && \
  17. curl -o $FILENAME -L https://github.com/actions/runner/releases/download/v2.320.0/$FILENAME && \
  18. tar xzf $FILENAME && \
  19. rm $FILENAME
  20. # Install runner dependencies
  21. RUN uv pip install --system pytest-cov
  22. RUN ./bin/installdependencies.sh && \
  23. apt-get -y install libicu-dev
  24. # Inline ENTRYPOINT command to configure and start runner with default TOKEN and NAME
  25. ENTRYPOINT sh -c './config.sh --url https://github.com/ultralytics/ultralytics \
  26. --token ${GITHUB_RUNNER_TOKEN:-TOKEN} \
  27. --name ${GITHUB_RUNNER_NAME:-NAME} \
  28. --labels gpu-latest \
  29. --replace && \
  30. ./run.sh'
  31. # Usage Examples -------------------------------------------------------------------------------------------------------
  32. # Build and Push
  33. # t=ultralytics/ultralytics:latest-runner && sudo docker build -f docker/Dockerfile-runner -t $t . && sudo docker push $t
  34. # Pull and Run in detached mode with access to GPUs 0 and 1
  35. # 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