Dockerfile-runner 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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 YOLOv8 single/multi-GPU training and inference tests
  4. # Start FROM Ultralytics GPU image
  5. FROM ultralytics/ultralytics:latest
  6. # Set the working directory
  7. WORKDIR /actions-runner
  8. # Download and unpack the latest runner from https://github.com/actions/runner
  9. RUN FILENAME=actions-runner-linux-x64-2.317.0.tar.gz && \
  10. curl -o $FILENAME -L https://github.com/actions/runner/releases/download/v2.317.0/$FILENAME && \
  11. tar xzf $FILENAME && \
  12. rm $FILENAME
  13. # Install runner dependencies
  14. ENV RUNNER_ALLOW_RUNASROOT=1
  15. ENV DEBIAN_FRONTEND=noninteractive
  16. RUN pip install --no-cache-dir pytest-cov
  17. RUN ./bin/installdependencies.sh && \
  18. apt-get -y install libicu-dev
  19. # Inline ENTRYPOINT command to configure and start runner with default TOKEN and NAME
  20. ENTRYPOINT sh -c './config.sh --url https://github.com/ultralytics/ultralytics \
  21. --token ${GITHUB_RUNNER_TOKEN:-TOKEN} \
  22. --name ${GITHUB_RUNNER_NAME:-NAME} \
  23. --labels gpu-latest \
  24. --replace && \
  25. ./run.sh'
  26. # Usage Examples -------------------------------------------------------------------------------------------------------
  27. # Build and Push
  28. # t=ultralytics/ultralytics:latest-runner && sudo docker build -f docker/Dockerfile-runner -t $t . && sudo docker push $t
  29. # Pull and Run in detached mode with access to GPUs 0 and 1
  30. # 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