Added Docker CI #1
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build Docker | |
on: | |
push: | |
branches: [ develop, release/** ] | |
paths: | |
- 'Dockerfiles/**' | |
- '.github/workflows/**' | |
pull_request: | |
branches: [ develop, release/** ] | |
paths: | |
- 'Dockerfiles/**' | |
- '.github/workflows/**' | |
jobs: | |
find-dockerfiles: | |
name: Find Dockerfiles | |
runs-on: self-hosted | |
outputs: | |
files: ${{ steps.find-files.outputs.files }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Find Dockerfiles | |
id: find-files | |
run: | | |
echo "## Finding all Dockerfiles in the 'Dockerfiles/' directory" | |
FILES=$(find Dockerfiles/ -type f -printf "%f\n" | grep .*Dockerfile) | |
echo "Found Dockerfiles:" | |
echo "$FILES" | |
# Convert the array to JSON array | |
JSON_ARRAY=$(printf '%s\n' "${FILES[@]}" | jq -R . | jq -s . | jq -c .) | |
echo "JSON_ARRAY is" | |
echo $JSON_ARRAY | |
echo "files=$JSON_ARRAY" >> $GITHUB_OUTPUT | |
build: | |
name: Build Docker Images | |
runs-on: self-hosted | |
needs: find-dockerfiles | |
strategy: | |
matrix: | |
file: ${{fromJson(needs.find-dockerfiles.outputs.files)}} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Build Docker image for ${{matrix.file}} | |
uses: docker/build-push-action@v4 | |
with: | |
context: Dockerfiles/ | |
file: Dockerfiles/${{matrix.file}} | |
push: false | |
tags: rocm-examples/dockerci:latest | |