-
Notifications
You must be signed in to change notification settings - Fork 115
172 lines (155 loc) · 6.66 KB
/
build-images.yaml
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
name: Sample applications build,test,push images
# Build image once the PR is merged to main branch.
on:
pull_request:
workflow_dispatch:
branches: [ main ]
push:
workflow_dispatch:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest # windows-latest || macos-latest
env:
REGISTRY: quay.io/ai-lab
#GH_REGISTRY: ghcr.io
# github.repository as <account>/<repo>
SUMMARIZER_IMAGE: summarizer
CODEGEN_IMAGE: codegen
RAG_IMAGE: rag
CHROMADB_IMAGE: chromadb
steps:
- name: Remove unnecessary files
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
- uses: actions/checkout@v4
with:
fetch-depth: 0 # OR "2" -> To retrieve the preceding commit.
- name: Get changed rag files
id: changed-files-rag
uses: tj-actions/changed-files@v42
with:
files: |
recipes/natural_language_processing/rag/**
- name: Get changed summarizer files
id: changed-files-summarizer
uses: tj-actions/changed-files@v42
with:
files: |
recipes/natural_language_processing/summarizer/**
- name: Get changed code-generation files
id: changed-files-codegen
uses: tj-actions/changed-files@v42
with:
files: |
recipes/natural_language_processing/code-generation/**
- name: Get changed chromadb files
id: changed-files-chromadb
uses: tj-actions/changed-files@v42
with:
files: |
vector_dbs/chromadb/**
- name: Install qemu dependency
if: steps.changed-files-summarizer.outputs.any_changed == 'true' || steps.changed-files-rag.outputs.any_changed == 'true' || steps.changed-files-codegen.outputs.any_changed == 'true'
run: |
sudo apt-get update
sudo apt-get install -y qemu-user-static
- name: Login Quay Container registry
if: >
(steps.changed-files-summarizer.outputs.any_changed == 'true' || steps.changed-files-rag.outputs.any_changed == 'true' || steps.changed-files-chromadb.outputs.any_changed == 'true' || steps.changed-files-codegen.outputs.any_changed == 'true') &&
(github.event_name == 'push' || github.event_name == 'schedule') &&
(github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v'))
uses: redhat-actions/podman-login@v1
with:
registry: quay.io
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Build code-generation
if: steps.changed-files-codegen.outputs.any_changed == 'true'
id: build_codegen_multiplatform
uses: redhat-actions/buildah-build@v2
with:
image: ${{ env.CODEGEN_IMAGE }}
tags: latest ${{ github.sha }}
platforms: linux/amd64, linux/arm64
context: recipes/natural_language_processing/code-generation
containerfiles: |
./recipes/natural_language_processing/code-generation/builds/Containerfile
- name: Push code-generation image
id: push_codegen
if: >
(steps.changed-files-codegen.outputs.any_changed == 'true') &&
(github.event_name == 'push' || github.event_name == 'schedule') &&
(github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v'))
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ steps.build_codegen_multiplatform.outputs.image }}
tags: ${{ steps.build_codegen_multiplatform.outputs.tags }}
registry: ${{ env.REGISTRY }}
- name: Build summarizer
if: steps.changed-files-summarizer.outputs.any_changed == 'true'
id: build_summarizer_multiplatform
uses: redhat-actions/buildah-build@v2
with:
image: ${{ env.SUMMARIZER_IMAGE }}
tags: latest ${{ github.sha }}
platforms: linux/amd64, linux/arm64
context: recipes/natural_language_processing/summarizer
containerfiles: |
./recipes/natural_language_processing/summarizer/builds/Containerfile
- name: Push summarizer image
id: push_summarizer
if: >
(steps.changed-files-summarizer.outputs.any_changed == 'true') &&
(github.event_name == 'push' || github.event_name == 'schedule') &&
(github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v'))
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ steps.build_summarizer_multiplatform.outputs.image }}
tags: ${{ steps.build_summarizer_multiplatform.outputs.tags }}
registry: ${{ env.REGISTRY }}
- name: Build RAG
if: steps.changed-files-rag.outputs.any_changed == 'true'
id: build_rag_multiplatform
uses: redhat-actions/buildah-build@v2
with:
image: ${{ env.RAG_IMAGE }}
tags: latest ${{ github.sha }}
platforms: linux/arm64, linux/amd64
context: recipes/natural_language_processing/rag
containerfiles: |
./recipes/natural_language_processing/rag/builds/Containerfile
- name: Push rag image
id: push_rag
if: >
(steps.changed-files-rag.outputs.any_changed == 'true') &&
(github.event_name == 'push' || github.event_name == 'schedule') &&
(github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v'))
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ steps.build_rag_multiplatform.outputs.image }}
tags: ${{ steps.build_rag_multiplatform.outputs.tags }}
registry: ${{ env.REGISTRY }}
- name: Build chromadb
if: steps.changed-files-chromadb.outputs.any_changed == 'true'
id: build_chromadb_multiplatform
uses: redhat-actions/buildah-build@v2
with:
image: ${{ env.CHROMADB_IMAGE }}
tags: latest ${{ github.sha }}
platforms: linux/arm64, linux/amd64
context: vector_dbs/chromadb
containerfiles: |
./vector_dbs/chromadb/Containerfile
- name: Push chromadb image
id: push_chromadb
if: >
(steps.changed-files-chromadb.outputs.any_changed == 'true') &&
(github.event_name == 'push' || github.event_name == 'schedule') &&
(github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v'))
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ steps.build_chromadb_multiplatform.outputs.image }}
tags: ${{ steps.build_chromadb_multiplatform.outputs.tags }}
registry: ${{ env.REGISTRY }}