-
Notifications
You must be signed in to change notification settings - Fork 47
56 lines (52 loc) · 1.71 KB
/
build_docker.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
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