Skip to content

Commit 2e5b5e4

Browse files
authored
Merge branch 'master' into master
2 parents f7693bb + e94a34b commit 2e5b5e4

File tree

14 files changed

+244
-152
lines changed

14 files changed

+244
-152
lines changed

.github/workflows/image.yml

Lines changed: 52 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,25 @@ concurrency:
1414
cancel-in-progress: true
1515

1616
jobs:
17-
image-build:
17+
extras-image-build:
18+
uses: ./.github/workflows/image_build.yml
19+
with:
20+
tag-latest: ${{ matrix.tag-latest }}
21+
tag-suffix: ${{ matrix.tag-suffix }}
22+
ffmpeg: ${{ matrix.ffmpeg }}
23+
image-type: ${{ matrix.image-type }}
24+
build-type: ${{ matrix.build-type }}
25+
cuda-major-version: ${{ matrix.cuda-major-version }}
26+
cuda-minor-version: ${{ matrix.cuda-minor-version }}
27+
platforms: ${{ matrix.platforms }}
28+
runs-on: ${{ matrix.runs-on }}
29+
secrets:
30+
dockerUsername: ${{ secrets.LOCALAI_REGISTRY_USERNAME }}
31+
dockerPassword: ${{ secrets.LOCALAI_REGISTRY_PASSWORD }}
1832
strategy:
33+
# Pushing with all jobs in parallel
34+
# eats the bandwidth of all the nodes
35+
max-parallel: ${{ github.event_name != 'pull_request' && 2 || 4 }}
1936
matrix:
2037
include:
2138
- build-type: ''
@@ -34,35 +51,35 @@ jobs:
3451
image-type: 'extras'
3552
runs-on: 'arc-runner-set'
3653
- build-type: 'cublas'
37-
cuda-major-version: 11
38-
cuda-minor-version: 7
54+
cuda-major-version: "11"
55+
cuda-minor-version: "7"
3956
platforms: 'linux/amd64'
4057
tag-latest: 'false'
4158
tag-suffix: '-cublas-cuda11'
4259
ffmpeg: ''
4360
image-type: 'extras'
4461
runs-on: 'arc-runner-set'
4562
- build-type: 'cublas'
46-
cuda-major-version: 12
47-
cuda-minor-version: 1
63+
cuda-major-version: "12"
64+
cuda-minor-version: "1"
4865
platforms: 'linux/amd64'
4966
tag-latest: 'false'
5067
tag-suffix: '-cublas-cuda12'
5168
ffmpeg: ''
5269
image-type: 'extras'
5370
runs-on: 'arc-runner-set'
5471
- build-type: 'cublas'
55-
cuda-major-version: 11
56-
cuda-minor-version: 7
72+
cuda-major-version: "11"
73+
cuda-minor-version: "7"
5774
platforms: 'linux/amd64'
5875
tag-latest: 'false'
5976
tag-suffix: '-cublas-cuda11-ffmpeg'
6077
ffmpeg: 'true'
6178
image-type: 'extras'
6279
runs-on: 'arc-runner-set'
6380
- build-type: 'cublas'
64-
cuda-major-version: 12
65-
cuda-minor-version: 1
81+
cuda-major-version: "12"
82+
cuda-minor-version: "1"
6683
platforms: 'linux/amd64'
6784
tag-latest: 'false'
6885
tag-suffix: '-cublas-cuda12-ffmpeg'
@@ -77,6 +94,24 @@ jobs:
7794
ffmpeg: ''
7895
image-type: 'extras'
7996
runs-on: 'arc-runner-set'
97+
core-image-build:
98+
uses: ./.github/workflows/image_build.yml
99+
with:
100+
tag-latest: ${{ matrix.tag-latest }}
101+
tag-suffix: ${{ matrix.tag-suffix }}
102+
ffmpeg: ${{ matrix.ffmpeg }}
103+
image-type: ${{ matrix.image-type }}
104+
build-type: ${{ matrix.build-type }}
105+
cuda-major-version: ${{ matrix.cuda-major-version }}
106+
cuda-minor-version: ${{ matrix.cuda-minor-version }}
107+
platforms: ${{ matrix.platforms }}
108+
runs-on: ${{ matrix.runs-on }}
109+
secrets:
110+
dockerUsername: ${{ secrets.LOCALAI_REGISTRY_USERNAME }}
111+
dockerPassword: ${{ secrets.LOCALAI_REGISTRY_PASSWORD }}
112+
strategy:
113+
matrix:
114+
include:
80115
- build-type: ''
81116
platforms: 'linux/amd64'
82117
tag-latest: 'false'
@@ -85,133 +120,38 @@ jobs:
85120
image-type: 'core'
86121
runs-on: 'ubuntu-latest'
87122
- build-type: 'cublas'
88-
cuda-major-version: 11
89-
cuda-minor-version: 7
123+
cuda-major-version: "11"
124+
cuda-minor-version: "7"
90125
platforms: 'linux/amd64'
91126
tag-latest: 'false'
92127
tag-suffix: '-cublas-cuda11-core'
93128
ffmpeg: ''
94129
image-type: 'core'
95130
runs-on: 'ubuntu-latest'
96131
- build-type: 'cublas'
97-
cuda-major-version: 12
98-
cuda-minor-version: 1
132+
cuda-major-version: "12"
133+
cuda-minor-version: "1"
99134
platforms: 'linux/amd64'
100135
tag-latest: 'false'
101136
tag-suffix: '-cublas-cuda12-core'
102137
ffmpeg: ''
103138
image-type: 'core'
104139
runs-on: 'ubuntu-latest'
105140
- build-type: 'cublas'
106-
cuda-major-version: 11
107-
cuda-minor-version: 7
141+
cuda-major-version: "11"
142+
cuda-minor-version: "7"
108143
platforms: 'linux/amd64'
109144
tag-latest: 'false'
110145
tag-suffix: '-cublas-cuda11-ffmpeg-core'
111146
ffmpeg: 'true'
112147
image-type: 'core'
113148
runs-on: 'ubuntu-latest'
114149
- build-type: 'cublas'
115-
cuda-major-version: 12
116-
cuda-minor-version: 1
150+
cuda-major-version: "12"
151+
cuda-minor-version: "1"
117152
platforms: 'linux/amd64'
118153
tag-latest: 'false'
119154
tag-suffix: '-cublas-cuda12-ffmpeg-core'
120155
ffmpeg: 'true'
121156
image-type: 'core'
122157
runs-on: 'ubuntu-latest'
123-
124-
runs-on: ${{ matrix.runs-on }}
125-
steps:
126-
- name: Force Install GIT latest
127-
run: |
128-
sudo apt-get update \
129-
&& sudo apt-get install -y software-properties-common \
130-
&& sudo apt-get update \
131-
&& sudo add-apt-repository -y ppa:git-core/ppa \
132-
&& sudo apt-get update \
133-
&& sudo apt-get install -y git
134-
- name: Checkout
135-
uses: actions/checkout@v4
136-
# - name: Release space from worker
137-
# run: |
138-
# echo "Listing top largest packages"
139-
# pkgs=$(dpkg-query -Wf '${Installed-Size}\t${Package}\t${Status}\n' | awk '$NF == "installed"{print $1 "\t" $2}' | sort -nr)
140-
# head -n 30 <<< "${pkgs}"
141-
# echo
142-
# df -h
143-
# echo
144-
# sudo apt-get remove -y '^llvm-.*|^libllvm.*' || true
145-
# sudo apt-get remove --auto-remove android-sdk-platform-tools || true
146-
# sudo apt-get purge --auto-remove android-sdk-platform-tools || true
147-
# sudo rm -rf /usr/local/lib/android
148-
# sudo apt-get remove -y '^dotnet-.*|^aspnetcore-.*' || true
149-
# sudo rm -rf /usr/share/dotnet
150-
# sudo apt-get remove -y '^mono-.*' || true
151-
# sudo apt-get remove -y '^ghc-.*' || true
152-
# sudo apt-get remove -y '.*jdk.*|.*jre.*' || true
153-
# sudo apt-get remove -y 'php.*' || true
154-
# sudo apt-get remove -y hhvm powershell firefox monodoc-manual msbuild || true
155-
# sudo apt-get remove -y '^google-.*' || true
156-
# sudo apt-get remove -y azure-cli || true
157-
# sudo apt-get remove -y '^mongo.*-.*|^postgresql-.*|^mysql-.*|^mssql-.*' || true
158-
# sudo apt-get remove -y '^gfortran-.*' || true
159-
# sudo apt-get remove -y microsoft-edge-stable || true
160-
# sudo apt-get remove -y firefox || true
161-
# sudo apt-get remove -y powershell || true
162-
# sudo apt-get remove -y r-base-core || true
163-
# sudo apt-get autoremove -y
164-
# sudo apt-get clean
165-
# echo
166-
# echo "Listing top largest packages"
167-
# pkgs=$(dpkg-query -Wf '${Installed-Size}\t${Package}\t${Status}\n' | awk '$NF == "installed"{print $1 "\t" $2}' | sort -nr)
168-
# head -n 30 <<< "${pkgs}"
169-
# echo
170-
# sudo rm -rfv build || true
171-
# df -h
172-
- name: Docker meta
173-
id: meta
174-
uses: docker/metadata-action@v5
175-
with:
176-
images: quay.io/go-skynet/local-ai
177-
tags: |
178-
type=ref,event=branch
179-
type=semver,pattern={{raw}}
180-
type=sha
181-
flavor: |
182-
latest=${{ matrix.tag-latest }}
183-
suffix=${{ matrix.tag-suffix }}
184-
185-
- name: Set up QEMU
186-
uses: docker/setup-qemu-action@master
187-
with:
188-
platforms: all
189-
190-
- name: Set up Docker Buildx
191-
id: buildx
192-
uses: docker/setup-buildx-action@master
193-
194-
- name: Login to DockerHub
195-
if: github.event_name != 'pull_request'
196-
uses: docker/login-action@v3
197-
with:
198-
registry: quay.io
199-
username: ${{ secrets.LOCALAI_REGISTRY_USERNAME }}
200-
password: ${{ secrets.LOCALAI_REGISTRY_PASSWORD }}
201-
202-
- name: Build and push
203-
uses: docker/build-push-action@v5
204-
with:
205-
builder: ${{ steps.buildx.outputs.name }}
206-
build-args: |
207-
BUILD_TYPE=${{ matrix.build-type }}
208-
CUDA_MAJOR_VERSION=${{ matrix.cuda-major-version }}
209-
CUDA_MINOR_VERSION=${{ matrix.cuda-minor-version }}
210-
FFMPEG=${{ matrix.ffmpeg }}
211-
IMAGE_TYPE=${{ matrix.image-type }}
212-
context: .
213-
file: ./Dockerfile
214-
platforms: ${{ matrix.platforms }}
215-
push: ${{ github.event_name != 'pull_request' }}
216-
tags: ${{ steps.meta.outputs.tags }}
217-
labels: ${{ steps.meta.outputs.labels }}

.github/workflows/image_build.yml

Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
---
2+
name: 'build container images (reusable)'
3+
4+
on:
5+
workflow_call:
6+
inputs:
7+
build-type:
8+
description: 'Build type'
9+
default: ''
10+
type: string
11+
cuda-major-version:
12+
description: 'CUDA major version'
13+
default: "11"
14+
type: string
15+
cuda-minor-version:
16+
description: 'CUDA minor version'
17+
default: "7"
18+
type: string
19+
platforms:
20+
description: 'Platforms'
21+
default: ''
22+
type: string
23+
tag-latest:
24+
description: 'Tag latest'
25+
default: ''
26+
type: string
27+
tag-suffix:
28+
description: 'Tag suffix'
29+
default: ''
30+
type: string
31+
ffmpeg:
32+
description: 'FFMPEG'
33+
default: ''
34+
type: string
35+
image-type:
36+
description: 'Image type'
37+
default: ''
38+
type: string
39+
runs-on:
40+
description: 'Runs on'
41+
required: true
42+
default: ''
43+
type: string
44+
secrets:
45+
dockerUsername:
46+
required: true
47+
dockerPassword:
48+
required: true
49+
jobs:
50+
reusable_image-build:
51+
runs-on: ${{ inputs.runs-on }}
52+
steps:
53+
- name: Force Install GIT latest
54+
run: |
55+
sudo apt-get update \
56+
&& sudo apt-get install -y software-properties-common \
57+
&& sudo apt-get update \
58+
&& sudo add-apt-repository -y ppa:git-core/ppa \
59+
&& sudo apt-get update \
60+
&& sudo apt-get install -y git
61+
- name: Checkout
62+
uses: actions/checkout@v4
63+
# - name: Release space from worker
64+
# run: |
65+
# echo "Listing top largest packages"
66+
# pkgs=$(dpkg-query -Wf '${Installed-Size}\t${Package}\t${Status}\n' | awk '$NF == "installed"{print $1 "\t" $2}' | sort -nr)
67+
# head -n 30 <<< "${pkgs}"
68+
# echo
69+
# df -h
70+
# echo
71+
# sudo apt-get remove -y '^llvm-.*|^libllvm.*' || true
72+
# sudo apt-get remove --auto-remove android-sdk-platform-tools || true
73+
# sudo apt-get purge --auto-remove android-sdk-platform-tools || true
74+
# sudo rm -rf /usr/local/lib/android
75+
# sudo apt-get remove -y '^dotnet-.*|^aspnetcore-.*' || true
76+
# sudo rm -rf /usr/share/dotnet
77+
# sudo apt-get remove -y '^mono-.*' || true
78+
# sudo apt-get remove -y '^ghc-.*' || true
79+
# sudo apt-get remove -y '.*jdk.*|.*jre.*' || true
80+
# sudo apt-get remove -y 'php.*' || true
81+
# sudo apt-get remove -y hhvm powershell firefox monodoc-manual msbuild || true
82+
# sudo apt-get remove -y '^google-.*' || true
83+
# sudo apt-get remove -y azure-cli || true
84+
# sudo apt-get remove -y '^mongo.*-.*|^postgresql-.*|^mysql-.*|^mssql-.*' || true
85+
# sudo apt-get remove -y '^gfortran-.*' || true
86+
# sudo apt-get remove -y microsoft-edge-stable || true
87+
# sudo apt-get remove -y firefox || true
88+
# sudo apt-get remove -y powershell || true
89+
# sudo apt-get remove -y r-base-core || true
90+
# sudo apt-get autoremove -y
91+
# sudo apt-get clean
92+
# echo
93+
# echo "Listing top largest packages"
94+
# pkgs=$(dpkg-query -Wf '${Installed-Size}\t${Package}\t${Status}\n' | awk '$NF == "installed"{print $1 "\t" $2}' | sort -nr)
95+
# head -n 30 <<< "${pkgs}"
96+
# echo
97+
# sudo rm -rfv build || true
98+
# df -h
99+
- name: Docker meta
100+
id: meta
101+
uses: docker/metadata-action@v5
102+
with:
103+
images: quay.io/go-skynet/local-ai
104+
tags: |
105+
type=ref,event=branch
106+
type=semver,pattern={{raw}}
107+
type=sha
108+
flavor: |
109+
latest=${{ inputs.tag-latest }}
110+
suffix=${{ inputs.tag-suffix }}
111+
112+
- name: Set up QEMU
113+
uses: docker/setup-qemu-action@master
114+
with:
115+
platforms: all
116+
117+
- name: Set up Docker Buildx
118+
id: buildx
119+
uses: docker/setup-buildx-action@master
120+
121+
- name: Login to DockerHub
122+
if: github.event_name != 'pull_request'
123+
uses: docker/login-action@v3
124+
with:
125+
registry: quay.io
126+
username: ${{ secrets.dockerUsername }}
127+
password: ${{ secrets.dockerPassword }}
128+
129+
- name: Build and push
130+
uses: docker/build-push-action@v5
131+
with:
132+
builder: ${{ steps.buildx.outputs.name }}
133+
build-args: |
134+
BUILD_TYPE=${{ inputs.build-type }}
135+
CUDA_MAJOR_VERSION=${{ inputs.cuda-major-version }}
136+
CUDA_MINOR_VERSION=${{ inputs.cuda-minor-version }}
137+
FFMPEG=${{ inputs.ffmpeg }}
138+
IMAGE_TYPE=${{ inputs.image-type }}
139+
context: .
140+
file: ./Dockerfile
141+
platforms: ${{ inputs.platforms }}
142+
push: ${{ github.event_name != 'pull_request' }}
143+
tags: ${{ steps.meta.outputs.tags }}
144+
labels: ${{ steps.meta.outputs.labels }}
145+
- name: job summary
146+
run: |
147+
echo "Built image: ${{ steps.meta.outputs.labels }}" >> $GITHUB_STEP_SUMMARY

0 commit comments

Comments
 (0)