|
|
@ -8,23 +8,48 @@ on:
|
|
|
|
branches: [main]
|
|
|
|
branches: [main]
|
|
|
|
workflow_dispatch:
|
|
|
|
workflow_dispatch:
|
|
|
|
inputs:
|
|
|
|
inputs:
|
|
|
|
image:
|
|
|
|
dockerfile:
|
|
|
|
type: choice
|
|
|
|
type: choice
|
|
|
|
description: Select Docker Image
|
|
|
|
description: Select Dockerfile
|
|
|
|
options:
|
|
|
|
options:
|
|
|
|
- Arm64
|
|
|
|
- Dockerfile-arm64
|
|
|
|
- Jetson
|
|
|
|
- Dockerfile-jetson
|
|
|
|
- Python
|
|
|
|
- Dockerfile-python
|
|
|
|
- CPU
|
|
|
|
- Dockerfile-cpu
|
|
|
|
- GPU
|
|
|
|
- Dockerfile
|
|
|
|
|
|
|
|
push:
|
|
|
|
|
|
|
|
type: boolean
|
|
|
|
|
|
|
|
description: Push image to Docker Hub
|
|
|
|
|
|
|
|
default: true
|
|
|
|
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
jobs:
|
|
|
|
docker:
|
|
|
|
docker:
|
|
|
|
if: github.repository == 'ultralytics/ultralytics'
|
|
|
|
if: github.repository == 'ultralytics/ultralytics'
|
|
|
|
name: Push Docker image to Docker Hub
|
|
|
|
name: Push
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
strategy:
|
|
|
|
|
|
|
|
fail-fast: false
|
|
|
|
|
|
|
|
max-parallel: 5
|
|
|
|
|
|
|
|
matrix:
|
|
|
|
|
|
|
|
include:
|
|
|
|
|
|
|
|
- dockerfile: "Dockerfile-arm64"
|
|
|
|
|
|
|
|
tags: "latest-arm64"
|
|
|
|
|
|
|
|
platforms: "linux/arm64"
|
|
|
|
|
|
|
|
- dockerfile: "Dockerfile-jetson"
|
|
|
|
|
|
|
|
tags: "latest-jetson"
|
|
|
|
|
|
|
|
platforms: "linux/arm64"
|
|
|
|
|
|
|
|
- dockerfile: "Dockerfile-python"
|
|
|
|
|
|
|
|
tags: "latest-python"
|
|
|
|
|
|
|
|
platforms: "linux/amd64"
|
|
|
|
|
|
|
|
- dockerfile: "Dockerfile-cpu"
|
|
|
|
|
|
|
|
tags: "latest-cpu"
|
|
|
|
|
|
|
|
platforms: "linux/amd64"
|
|
|
|
|
|
|
|
- dockerfile: "Dockerfile"
|
|
|
|
|
|
|
|
tags: "latest"
|
|
|
|
|
|
|
|
platforms: "linux/amd64"
|
|
|
|
steps:
|
|
|
|
steps:
|
|
|
|
- name: Checkout repo
|
|
|
|
- name: Checkout repo
|
|
|
|
|
|
|
|
if: github.event_name == 'push' || github.event.inputs.dockerfile == matrix.dockerfile
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
|
|
|
|
|
|
|
|
- name: Set up QEMU
|
|
|
|
- name: Set up QEMU
|
|
|
@ -39,54 +64,30 @@ jobs:
|
|
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
|
|
|
|
|
|
|
|
|
|
- name: Build and push arm64 image
|
|
|
|
- name: Build Image
|
|
|
|
if: github.event_name == 'push' || github.event.inputs.image == 'Arm64'
|
|
|
|
run: |
|
|
|
|
uses: docker/build-push-action@v4
|
|
|
|
docker build --platform ${{ matrix.platforms }} -f docker/${{ matrix.dockerfile }} -t ultralytics/ultralytics:${{ matrix.tags }} .
|
|
|
|
continue-on-error: true
|
|
|
|
|
|
|
|
with:
|
|
|
|
|
|
|
|
context: .
|
|
|
|
|
|
|
|
platforms: linux/arm64
|
|
|
|
|
|
|
|
file: docker/Dockerfile-arm64
|
|
|
|
|
|
|
|
push: true
|
|
|
|
|
|
|
|
tags: ultralytics/ultralytics:latest-arm64
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- name: Build and push Jetson image
|
|
|
|
- name: Run Tests
|
|
|
|
if: github.event_name == 'push' || github.event.inputs.image == 'Jetson'
|
|
|
|
if: matrix.platforms == 'linux/amd64' # arm64 images not supported on GitHub CI runners
|
|
|
|
uses: docker/build-push-action@v4
|
|
|
|
run: |
|
|
|
|
continue-on-error: true
|
|
|
|
docker run ultralytics/ultralytics:${{ matrix.tags }} /bin/bash -c "pip install pytest && pytest tests"
|
|
|
|
with:
|
|
|
|
|
|
|
|
context: .
|
|
|
|
|
|
|
|
platforms: linux/arm64
|
|
|
|
|
|
|
|
file: docker/Dockerfile-jetson
|
|
|
|
|
|
|
|
push: true
|
|
|
|
|
|
|
|
tags: ultralytics/ultralytics:latest-jetson
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- name: Build and push Python image
|
|
|
|
- name: Run Benchmarks
|
|
|
|
if: github.event_name == 'push' || github.event.inputs.image == 'Python'
|
|
|
|
if: matrix.platforms == 'linux/amd64' # arm64 images not supported on GitHub CI runners
|
|
|
|
uses: docker/build-push-action@v4
|
|
|
|
run: |
|
|
|
|
continue-on-error: true
|
|
|
|
docker run ultralytics/ultralytics:${{ matrix.tags }} yolo benchmark model=yolov8n.pt imgsz=160
|
|
|
|
with:
|
|
|
|
|
|
|
|
context: .
|
|
|
|
|
|
|
|
file: docker/Dockerfile-python
|
|
|
|
|
|
|
|
push: true
|
|
|
|
|
|
|
|
tags: ultralytics/ultralytics:latest-python
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- name: Build and push CPU image
|
|
|
|
- name: Push Image
|
|
|
|
if: github.event_name == 'push' || github.event.inputs.image == 'CPU'
|
|
|
|
if: github.event_name == 'push' || github.event.inputs.push == true
|
|
|
|
uses: docker/build-push-action@v4
|
|
|
|
run: |
|
|
|
|
continue-on-error: true
|
|
|
|
docker push ultralytics/ultralytics:${{ matrix.tags }}
|
|
|
|
with:
|
|
|
|
|
|
|
|
context: .
|
|
|
|
|
|
|
|
file: docker/Dockerfile-cpu
|
|
|
|
|
|
|
|
push: true
|
|
|
|
|
|
|
|
tags: ultralytics/ultralytics:latest-cpu
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- name: Build and push GPU image
|
|
|
|
- name: Notify on failure
|
|
|
|
if: github.event_name == 'push' || github.event.inputs.image == 'GPU'
|
|
|
|
if: github.event_name == 'push' && (cancelled() || failure())
|
|
|
|
uses: docker/build-push-action@v4
|
|
|
|
uses: slackapi/slack-github-action@v1.23.0
|
|
|
|
continue-on-error: true
|
|
|
|
|
|
|
|
with:
|
|
|
|
with:
|
|
|
|
context: .
|
|
|
|
payload: |
|
|
|
|
file: docker/Dockerfile
|
|
|
|
{"text": "<!channel> GitHub Actions error for ${{ github.workflow }} ❌\n\n\n*Repository:* https://github.com/${{ github.repository }}\n*Action:* https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}\n*Author:* ${{ github.actor }}\n*Event:* ${{ github.event_name }}\n"}
|
|
|
|
push: true
|
|
|
|
env:
|
|
|
|
tags: ultralytics/ultralytics:latest
|
|
|
|
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL_YOLO }}
|
|
|
|