-
Notifications
You must be signed in to change notification settings - Fork 2
264 lines (242 loc) · 9.7 KB
/
github-actions-build-all.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
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
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
name: Build & publish all recipe images
on:
[push]
# release:
# types: [published]
env:
REGISTRY: ghcr.io
jobs:
truss-recipe:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- recipe-name: gpt2
version: "0.1"
- recipe-name: bert-base-uncased
version: "0.2"
- recipe-name: whisper-medium
version: "0.2"
- recipe-name: clip-vit-large-patch14
version: "0.2"
- recipe-name: t5-base
version: "0.2"
- recipe-name: toxic-comment-model
version: "0.2"
- recipe-name: vit-age-classifier
version: "0.2"
- recipe-name: wav2vec2-large-xlsr-53-english
version: "0.2"
- recipe-name: bart-large-cnn
version: "0.2"
- recipe-name: parrot_adequacy_model
version: "0.2"
- recipe-name: roberta-base-squad2
version: "0.2"
- recipe-name: twitter-roberta-base-sentiment
version: "0.2"
- recipe-name: vit-gpt2-image-captioning
version: "0.2"
- recipe-name: roberta-base
version: "0.2"
- recipe-name: twitter-roberta-base-sentiment
version: "0.2"
- recipe-name: bloom-560m
version: "0.1"
- recipe-name: falcon-7b-instruct
version: "0.2"
permissions:
contents: read
packages: write
actions: write
steps:
# Check if the package already exists for this version and skip the build if it does
- name: Check for changes
id: check_new
run: |
tags=$(curl -L \
--header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \
--header 'content-type: application/json' \
https://api.github.com/orgs/saladtechnologies/packages/container/recipe-${{ matrix.recipe-name }}/versions | jq -r 'try(.[0].metadata.container.tags | any(. == "${{ matrix.version }}") ) catch "false"')
echo $tags
# Checks to see if the specified version already exists in the packages versions
if [ "$tags" == "false" ]; then
echo "IS_NEW=true" >> $GITHUB_OUTPUT
echo "It is new!!!"
else
echo "IS_NEW=false" >> $GITHUB_OUTPUT
echo "This tag already exists."
fi
# Check out the repo
- name: Checkout repository
if: ${{ steps.check_new.outputs.IS_NEW == 'true' }}
uses: actions/checkout@v2
# Log into GHCR
- name: Log in to the Container registry
if: ${{ steps.check_new.outputs.IS_NEW == 'true' }}
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# Setup Python (faster than using Python container)
- name: Setup Python
if: ${{ steps.check_new.outputs.IS_NEW == 'true' }}
uses: actions/setup-python@v2
with:
python-version: "3.9"
# Install Truss
- name: Install Truss
if: ${{ steps.check_new.outputs.IS_NEW == 'true' }}
run: |
python -m pip install truss
# Build truss container context
- name: Build Truss docker image
if: ${{ steps.check_new.outputs.IS_NEW == 'true' }}
run: truss build-context ./src/${{ matrix.recipe-name }}/out ./src/${{ matrix.recipe-name }}
# Add socat and startup script to Docker image for IPv6 tunneling
- name: Add socat to Docker image
if: ${{ steps.check_new.outputs.IS_NEW == 'true' }}
run: |
echo '#!/bin/bash' > ./src/${{ matrix.recipe-name }}/out/server/start.sh
echo "echo 'socat TCP6-LISTEN:8888,fork TCP4:127.0.0.1:8080 &'" >> ./src/${{ matrix.recipe-name }}/out/server/start.sh
echo 'socat TCP6-LISTEN:8888,fork TCP4:127.0.0.1:8080 &' >> ./src/${{ matrix.recipe-name }}/out/server/start.sh
echo 'python3 /app/inference_server.py' >> ./src/${{ matrix.recipe-name }}/out/server/start.sh
chmod +x ./src/${{ matrix.recipe-name }}/out/server/start.sh
sed -i -r ':a; /^\s*$/ {N;ba}; s/( *\n *){2,}/\n\n/' ./src/${{ matrix.recipe-name }}/out/Dockerfile
sed -i '/COPY .\/server_requirements.txt.*/i # Salad Recipes require IPv6 tunnels\nRUN apt update\nRUN apt install -y socat\n' ./src/${{ matrix.recipe-name }}/out/Dockerfile
sed -i 's/^\(CMD exec python3 \/app.*\)/# \1\n\nCMD bash start.sh/' ./src/${{ matrix.recipe-name }}/out/Dockerfile
# Get meta data
- name: Extract metadata (tags, labels) for Docker
id: meta
if: ${{ steps.check_new.outputs.IS_NEW == 'true' }}
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ghcr.io/saladtechnologies/recipe-${{ matrix.recipe-name }}:${{ matrix.version }}
# Create and push image
- name: Build and push Docker image
if: ${{ steps.check_new.outputs.IS_NEW == 'true' }}
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: ./src/${{ matrix.recipe-name }}/out
push: true
tags: ghcr.io/saladtechnologies/recipe-${{ matrix.recipe-name }}:${{ matrix.version }}
labels: ${{ steps.meta.outputs.labels }}
docker-recipe:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- recipe-name: anything4.0
version: "0.4"
- recipe-name: openjourney4
version: "0.4"
- recipe-name: stable-diffusion-1.5
version: "0.3"
- recipe-name: stable-diffusion-2.1
version: "0.3"
- recipe-name: stable-diffusion-1.4
version: "0.3"
- recipe-name: falcon-7b-instruct-docker
version: "0.1"
- recipe-name: gpt-j-6b-test
version: "0.2"
- recipe-name: whisper
version: "0.1"
- recipe-name: llama-7b
version: "0.3"
- recipe-name: gfp-gan
version: "0.1"
- recipe-name: musicgen-large
version: "0.1"
- recipe-name: dolly-v2
version: "0.3"
- recipe-name: dolly-v2-docker
version: "0.1"
- recipe-name: alpaca-7b-recipe
version: '0.2'
#- recipe-name: pygmalion-6b
#version: '0.1'
- recipe-name: mpt-7b-base
version: '0.1'
- recipe-name: mpt-7b-storywriter
version: '0.1'
- recipe-name: mpt-7b-chat
version: '0.1'
- recipe-name: mpt-7b-instruct
version: '0.1'
- recipe-name: wizardlm
version: '0.1'
- recipe-name: dolly-v2-7b
version: "0.1"
- recipe-name: stablelm-base-3b
version: "0.1"
- recipe-name: stablelm-tuned-3b
version: "0.1"
- recipe-name: replit-code-1.3b
version: "0.1"
- recipe-name: layoutlm
version: "0.1"
#- recipe-name: sdxl
#version: "0.1"
- recipe-name: nsql
version: "0.1"
- recipe-name: code-llama-7b
version: "0.1"
- recipe-name: code-llama-python-7b
version: "0.1"
- recipe-name: code-llama-instruct-7b
version: "0.1"
permissions:
contents: read
packages: write
actions: write
steps:
# Check if the package already exists for this version and skip the build if it does
- name: Check for changes
id: check_new
run: |
tags=$(curl -L \
--header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \
--header 'content-type: application/json' \
https://api.github.com/orgs/saladtechnologies/packages/container/recipe-${{ matrix.recipe-name }}/versions | jq -r 'try(.[0].metadata.container.tags | any(. == "${{ matrix.version }}") ) catch "false"')
echo $tags
# Checks to see if the specified version already exists in the packages versions
if [ "$tags" == "false" ]; then
echo "IS_NEW=true" >> $GITHUB_OUTPUT
echo "It is new!!!"
else
echo "IS_NEW=false" >> $GITHUB_OUTPUT
echo "This tag already exists."
fi
# Check out the repo
- name: Checkout repository
if: ${{ steps.check_new.outputs.IS_NEW == 'true' }}
uses: actions/checkout@v2
# Log into GHCR
- name: Log in to the Container registry
if: ${{ steps.check_new.outputs.IS_NEW == 'true' }}
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# Get meta data
- name: Extract metadata (tags, labels) for Docker
id: meta
if: ${{ steps.check_new.outputs.IS_NEW == 'true' }}
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ghcr.io/saladtechnologies/recipe-${{ matrix.recipe-name }}:${{ matrix.version }}
# Create and push image
- name: Build and push Docker image
if: ${{ steps.check_new.outputs.IS_NEW == 'true' }}
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: ./src/${{ matrix.recipe-name }}
file: ./src/${{ matrix.recipe-name }}/Dockerfile
push: true
tags: ghcr.io/saladtechnologies/recipe-${{ matrix.recipe-name }}:${{ matrix.version }}
labels: ${{ steps.meta.outputs.labels }}