Skip to content

chage: build onnxruntime 1.18.0 for cuda 12 #89

chage: build onnxruntime 1.18.0 for cuda 12

chage: build onnxruntime 1.18.0 for cuda 12 #89

name: Build all changed Dockerfiles
on:
push:
branches:
- master
paths:
- '**/Dockerfile'
pull_request:
branches:
- master
paths:
- '**/Dockerfile'
jobs:
provide_changed_files:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # get all commits
-
name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v43
with:
separator: "', '"
since_last_remote_commit: "true"
files: |
**/Dockerfile
-
name: Echo the changed files
id: changes
run: |
changed_list="['${{ steps.changed-files.outputs.all_modified_files }}']";
echo "matrix=$changed_list" >> $GITHUB_OUTPUT;
outputs:
matrix: ${{ steps.changes.outputs.matrix }}
docker:
runs-on: ubuntu-latest
needs: provide_changed_files
if: "join(fromJSON(needs.provide_changed_files.outputs.matrix), '') != ''" # preoceed only when we have something to build
strategy:
matrix:
files: ${{fromJSON(needs.provide_changed_files.outputs.matrix)}}
steps:
-
name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
# this might remove tools that are actually needed,
# if set to "true" but frees about 6 GB
tool-cache: true
# all of these default to true, but feel free to set to
# "false" if necessary for your workflow
android: true
dotnet: true
haskell: true
large-packages: false
docker-images: false
swap-storage: true
-
name: Checkout
uses: actions/checkout@v4
# -
# name: Set up QEMU
# uses: docker/setup-qemu-action@v2
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Get path and create tag
id: dockerfile
run: |
filepath=${{ matrix.files }};
echo "path=$filepath" >> $GITHUB_OUTPUT;
py_ver=$(echo $filepath | grep 'python-' | sed 's/.*\/python-\([0-9]*\)[\.]*\([0-9]*\)[^/]*.*Dockerfile/-py\1\2/');
tag=$(echo $filepath | sed 's/pytorch-\([0-9\.]*\).*\/cuda-\([0-9]*\)[\.]*\([0-9]*\)[^/]*.*Dockerfile/\1-cu\2\3/' | sed 's/\(.*\)\/Dockerfile/\1/' | sed 's/\//-/g');
echo "tag=${tag}${py_ver}" >> $GITHUB_OUTPUT;
-
name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GIT_PACKAGES_TOKEN }}
-
name: Build and push Docker Hub
uses: docker/build-push-action@v5
with:
context: .
file: ${{ steps.dockerfile.outputs.path }}
push: true
tags: |
${{ secrets.DOCKERHUB_USERNAME }}/${{ github.event.repository.name }}:${{ steps.dockerfile.outputs.tag }}
ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}:${{ steps.dockerfile.outputs.tag }}