-
Notifications
You must be signed in to change notification settings - Fork 112
235 lines (211 loc) · 9.46 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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
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]
permissions: write-all
jobs:
build:
runs-on: ubuntu-latest # windows-latest || macos-latest
env:
REGISTRY: quay.io/redhat-et
#GH_REGISTRY: ghcr.io
# github.repository as <account>/<repo>
MODEL_SERVICE_IMAGE: locallm-model-service
CHATBOT_IMAGE: locallm-chatbot
SUMMARIZER_IMAGE: locallm-text-summarizer
CODEGEN_IMAGE: locallm-codegen
RAG_IMAGE: locallm-rag
CHROMADB_IMAGE: locallm-chromadb
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # OR "2" -> To retrieve the preceding commit.
- name: Get changed model-service files
id: changed-files-model-service
uses: tj-actions/changed-files@v42
with:
files: |
model_servers/llamacpp_python/base/**
- 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 chatbot files
id: changed-files-chatbot
uses: tj-actions/changed-files@v42
with:
files: |
recipes/natural_language_processing/chatbot/**
- 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-model-service.outputs.any_changed == 'true' || steps.changed-files-chatbot.outputs.any_changed == 'true' || 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-model-service.outputs.any_changed == 'true' || steps.changed-files-chatbot.outputs.any_changed == 'true' || 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 model-service
if: steps.changed-files-model-service.outputs.any_changed == 'true'
id: build_model_service_multiplatform
uses: redhat-actions/buildah-build@v2
with:
image: ${{ env.MODEL_SERVICE_IMAGE }}
tags: latest ${{ github.sha }}
platforms: linux/amd64, linux/arm64
context: model_servers/llamacpp_python
containerfiles: ./model_servers/llamacpp_python/base/Containerfile
- name: Push model-service image
id: push_model_service
if: >
(steps.changed-files-model-service.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_model_service_multiplatform.outputs.image }}
tags: ${{ steps.build_model_service_multiplatform.outputs.tags }}
registry: ${{ env.REGISTRY }}
- name: Build chatbot
id: build_chatbot_multiplatform
uses: redhat-actions/buildah-build@v2
if: steps.changed-files-chatbot.outputs.any_changed == 'true'
with:
image: ${{ env.CHATBOT_IMAGE }}
tags: latest ${{ github.sha }}
platforms: linux/amd64, linux/arm64
context: recipes/natural_language_processing/chatbot
containerfiles: |
recipes/natural_language_processing/chatbot/builds/Containerfile
- name: Push chatbot image
id: push_chatbot
if: >
(steps.changed-files-chatbot.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_chatbot_multiplatform.outputs.image }}
tags: ${{ steps.build_chatbot_multiplatform.outputs.tags }}
registry: ${{ env.REGISTRY }}
- 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 }}
# TODO: add amd64
platforms: linux/arm64
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 }}
# TODO: add amd64
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 }}