Skip to content

Commit c8c3671

Browse files
committed
[Amir] Update Vulkan Dockerfile to be in sync with .devops versions, added GitHub Actions for missing dockerfiles
- Modified the Vulkan Dockerfile to dynamically handle architecture-specific paths during installation. - Enhanced the health check command to verify the presence of the Vulkan server for both x86_64 and aarch64 architectures. - Updated GitHub Actions workflow to support building for both linux/amd64 and linux/arm64 platforms. - Added new build jobs for MUSA, Intel, and CANN variants, ensuring comprehensive multi-platform support in the CI pipeline.
1 parent 28b6645 commit c8c3671

File tree

2 files changed

+176
-14
lines changed

2 files changed

+176
-14
lines changed

.devops/base-images/vulkan.Dockerfile

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ RUN ARCH=$(uname -m) && \
1717
wget -qO /tmp/vulkan-sdk.tar.xz https://sdk.lunarg.com/sdk/download/${VULKAN_SDK_VERSION}/linux/vulkan-sdk-linux-${ARCH}-${VULKAN_SDK_VERSION}.tar.xz && \
1818
mkdir -p /opt/vulkan && \
1919
tar -xf /tmp/vulkan-sdk.tar.xz -C /tmp --strip-components=1 && \
20-
mv /tmp/x86_64/* /opt/vulkan/ && \
20+
mv /tmp/${ARCH}/* /opt/vulkan/ && \
2121
rm -rf /tmp/*
2222

2323
# Install cURL and Vulkan SDK dependencies
@@ -36,7 +36,7 @@ WORKDIR /app
3636

3737
COPY . .
3838

39-
RUN cmake -B build -DGGML_NATIVE=OFF -DGGML_VULKAN=1 -DLLAMA_BUILD_TESTS=OFF -DGGML_BACKEND_DL=ON -DCMAKE_EXE_LINKER_FLAGS="-Wl,-rpath,\$ORIGIN" && \
39+
RUN cmake -B build -DGGML_NATIVE=OFF -DGGML_VULKAN=1 -DLLAMA_BUILD_TESTS=OFF -DGGML_BACKEND_DL=ON -DGGML_CPU_ALL_VARIANTS=ON -DCMAKE_EXE_LINKER_FLAGS="-Wl,-rpath,\$ORIGIN" && \
4040
cmake --build build --config Release -j$(nproc)
4141

4242
RUN mkdir -p /app/lib && \
@@ -111,7 +111,15 @@ USER llama
111111

112112
# BodhiApp: Health check - verify Vulkan availability and binary
113113
HEALTHCHECK --interval=30s --timeout=10s --start-period=10s --retries=3 \
114-
CMD test -x /app/llama-server && vulkaninfo > /dev/null 2>&1 || exit 1
114+
CMD ARCH=$(uname -m) && \
115+
if [ "$ARCH" = "x86_64" ]; then \
116+
test -x /app/bin/x86_64-unknown-linux-gnu/vulkan/llama-server; \
117+
elif [ "$ARCH" = "aarch64" ]; then \
118+
test -x /app/bin/aarch64-unknown-linux-gnu/vulkan/llama-server; \
119+
else \
120+
exit 1; \
121+
fi && \
122+
vulkaninfo > /dev/null 2>&1 || exit 1
115123

116124
# BodhiApp: Metadata labels
117125
LABEL org.opencontainers.image.title="BodhiApp llama.cpp Vulkan Runtime"

.github/workflows/base-images.yml

Lines changed: 165 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ jobs:
188188
with:
189189
context: .
190190
file: .devops/base-images/vulkan.Dockerfile
191-
platforms: linux/amd64
191+
platforms: linux/amd64,linux/arm64
192192
push: true
193193
tags: |
194194
${{ env.REGISTRY }}:vulkan-${{ needs.extract-version.outputs.version }}
@@ -198,13 +198,131 @@ jobs:
198198
BUILD_COMMIT=${{ github.sha }}
199199
BUILD_TIMESTAMP=${{ needs.extract-version.outputs.timestamp }}
200200
BUILD_BRANCH=${{ github.ref_name }}
201+
VULKAN_SDK_VERSION=1.4.321.1
201202
cache-from: type=gha,scope=vulkan
202203
cache-to: type=gha,mode=max,scope=vulkan
203204

205+
# Build MUSA variant (Moore Threads GPU, x86_64 only)
206+
build-musa:
207+
needs: extract-version
208+
runs-on: ubuntu-latest-8-cores
209+
timeout-minutes: 90
210+
steps:
211+
- name: Checkout code
212+
uses: actions/checkout@v4
213+
with:
214+
fetch-depth: 1
215+
216+
- name: Set up Docker Buildx
217+
uses: docker/setup-buildx-action@v3
218+
219+
- name: Login to Container Registry
220+
uses: docker/login-action@v3
221+
with:
222+
registry: ${{ env.REGISTRY }}
223+
username: ${{ github.actor }}
224+
password: ${{ secrets.GITHUB_TOKEN }}
225+
226+
- name: Build and push MUSA image
227+
uses: docker/build-push-action@v5
228+
with:
229+
context: .
230+
file: .devops/base-images/musa.Dockerfile
231+
platforms: linux/amd64
232+
push: true
233+
tags: |
234+
${{ env.REGISTRY }}:musa-${{ needs.extract-version.outputs.version }}
235+
${{ env.REGISTRY }}:latest-musa
236+
build-args: |
237+
BUILD_VERSION=${{ needs.extract-version.outputs.version }}
238+
BUILD_COMMIT=${{ github.sha }}
239+
BUILD_TIMESTAMP=${{ needs.extract-version.outputs.timestamp }}
240+
BUILD_BRANCH=${{ github.ref_name }}
241+
cache-from: type=gha,scope=musa
242+
cache-to: type=gha,mode=max,scope=musa
243+
244+
# Build Intel variant (Intel GPU with SYCL, x86_64 only)
245+
build-intel:
246+
needs: extract-version
247+
runs-on: ubuntu-latest-8-cores
248+
timeout-minutes: 90
249+
steps:
250+
- name: Checkout code
251+
uses: actions/checkout@v4
252+
with:
253+
fetch-depth: 1
254+
255+
- name: Set up Docker Buildx
256+
uses: docker/setup-buildx-action@v3
257+
258+
- name: Login to Container Registry
259+
uses: docker/login-action@v3
260+
with:
261+
registry: ${{ env.REGISTRY }}
262+
username: ${{ github.actor }}
263+
password: ${{ secrets.GITHUB_TOKEN }}
264+
265+
- name: Build and push Intel image
266+
uses: docker/build-push-action@v5
267+
with:
268+
context: .
269+
file: .devops/base-images/intel.Dockerfile
270+
platforms: linux/amd64
271+
push: true
272+
tags: |
273+
${{ env.REGISTRY }}:intel-${{ needs.extract-version.outputs.version }}
274+
${{ env.REGISTRY }}:latest-intel
275+
build-args: |
276+
BUILD_VERSION=${{ needs.extract-version.outputs.version }}
277+
BUILD_COMMIT=${{ github.sha }}
278+
BUILD_TIMESTAMP=${{ needs.extract-version.outputs.timestamp }}
279+
BUILD_BRANCH=${{ github.ref_name }}
280+
cache-from: type=gha,scope=intel
281+
cache-to: type=gha,mode=max,scope=intel
282+
283+
# Build CANN variant (Huawei Ascend NPU, supports multi-platform)
284+
build-cann:
285+
needs: extract-version
286+
runs-on: ubuntu-latest-8-cores
287+
timeout-minutes: 90
288+
steps:
289+
- name: Checkout code
290+
uses: actions/checkout@v4
291+
with:
292+
fetch-depth: 1
293+
294+
- name: Set up Docker Buildx
295+
uses: docker/setup-buildx-action@v3
296+
297+
- name: Login to Container Registry
298+
uses: docker/login-action@v3
299+
with:
300+
registry: ${{ env.REGISTRY }}
301+
username: ${{ github.actor }}
302+
password: ${{ secrets.GITHUB_TOKEN }}
303+
304+
- name: Build and push CANN image
305+
uses: docker/build-push-action@v5
306+
with:
307+
context: .
308+
file: .devops/base-images/cann.Dockerfile
309+
platforms: linux/amd64,linux/arm64
310+
push: true
311+
tags: |
312+
${{ env.REGISTRY }}:cann-${{ needs.extract-version.outputs.version }}
313+
${{ env.REGISTRY }}:latest-cann
314+
build-args: |
315+
BUILD_VERSION=${{ needs.extract-version.outputs.version }}
316+
BUILD_COMMIT=${{ github.sha }}
317+
BUILD_TIMESTAMP=${{ needs.extract-version.outputs.timestamp }}
318+
BUILD_BRANCH=${{ github.ref_name }}
319+
cache-from: type=gha,scope=cann
320+
cache-to: type=gha,mode=max,scope=cann
321+
204322
# Create GitHub Release (flexible - succeeds if any variant builds)
205323
create-release:
206-
needs: [extract-version, build-cpu, build-cuda, build-rocm, build-vulkan]
207-
if: always() && (needs.build-cpu.result == 'success' || needs.build-cuda.result == 'success' || needs.build-rocm.result == 'success' || needs.build-vulkan.result == 'success')
324+
needs: [extract-version, build-cpu, build-cuda, build-rocm, build-vulkan, build-musa, build-intel, build-cann]
325+
if: always() && (needs.build-cpu.result == 'success' || needs.build-cuda.result == 'success' || needs.build-rocm.result == 'success' || needs.build-vulkan.result == 'success' || needs.build-musa.result == 'success' || needs.build-intel.result == 'success' || needs.build-cann.result == 'success')
208326
runs-on: ubuntu-latest
209327
steps:
210328
- name: Create GitHub Release
@@ -224,7 +342,7 @@ jobs:
224342
225343
### Build Results
226344
227-
${{ needs.build-cpu.result == 'success' && '✅ **CPU Runtime** (Platform: linux/amd64)' || '❌ **CPU Runtime** - Build failed' }}
345+
${{ needs.build-cpu.result == 'success' && '✅ **CPU Runtime** (Platform: linux/amd64, linux/arm64)' || '❌ **CPU Runtime** - Build failed' }}
228346
${{ needs.build-cpu.result == 'success' && format('```bash
229347
docker pull {0}:cpu-{1}
230348
```', env.REGISTRY, needs.extract-version.outputs.version) || '' }}
@@ -239,11 +357,26 @@ jobs:
239357
docker pull {0}:rocm-{1}
240358
```', env.REGISTRY, needs.extract-version.outputs.version) || '' }}
241359
242-
${{ needs.build-vulkan.result == 'success' && '✅ **Vulkan Runtime** (Platform: linux/amd64)' || '❌ **Vulkan Runtime** - Build failed' }}
360+
${{ needs.build-vulkan.result == 'success' && '✅ **Vulkan Runtime** (Platform: linux/amd64, linux/arm64)' || '❌ **Vulkan Runtime** - Build failed' }}
243361
${{ needs.build-vulkan.result == 'success' && format('```bash
244362
docker pull {0}:vulkan-{1}
245363
```', env.REGISTRY, needs.extract-version.outputs.version) || '' }}
246-
364+
365+
${{ needs.build-musa.result == 'success' && '✅ **MUSA Runtime** (Platform: linux/amd64) - *Moore Threads GPU*' || '❌ **MUSA Runtime** - Build failed' }}
366+
${{ needs.build-musa.result == 'success' && format('```bash
367+
docker pull {0}:musa-{1}
368+
```', env.REGISTRY, needs.extract-version.outputs.version) || '' }}
369+
370+
${{ needs.build-intel.result == 'success' && '✅ **Intel Runtime** (Platform: linux/amd64) - *Intel GPU with SYCL*' || '❌ **Intel Runtime** - Build failed' }}
371+
${{ needs.build-intel.result == 'success' && format('```bash
372+
docker pull {0}:intel-{1}
373+
```', env.REGISTRY, needs.extract-version.outputs.version) || '' }}
374+
375+
${{ needs.build-cann.result == 'success' && '✅ **CANN Runtime** (Platform: linux/amd64, linux/arm64) - *Huawei Ascend NPU*' || '❌ **CANN Runtime** - Build failed' }}
376+
${{ needs.build-cann.result == 'success' && format('```bash
377+
docker pull {0}:cann-{1}
378+
```', env.REGISTRY, needs.extract-version.outputs.version) || '' }}
379+
247380
## Usage with BodhiApp
248381
249382
```dockerfile
@@ -281,7 +414,7 @@ jobs:
281414
# Build Summary
282415
summary:
283416
runs-on: ubuntu-latest
284-
needs: [extract-version, build-cpu, build-cuda, build-rocm, build-vulkan, create-release]
417+
needs: [extract-version, build-cpu, build-cuda, build-rocm, build-vulkan, build-musa, build-intel, build-cann, create-release]
285418
if: always()
286419
steps:
287420
- name: Build Summary
@@ -301,9 +434,9 @@ jobs:
301434
302435
# CPU
303436
if [[ "${{ needs.build-cpu.result }}" == "success" ]]; then
304-
echo "| CPU | ✅ Success | linux/amd64 | llama.cpp:cpu-${{ needs.extract-version.outputs.version }} |" >> $GITHUB_STEP_SUMMARY
437+
echo "| CPU | ✅ Success | linux/amd64,linux/arm64 | llama.cpp:cpu-${{ needs.extract-version.outputs.version }} |" >> $GITHUB_STEP_SUMMARY
305438
else
306-
echo "| CPU | ❌ Failed | linux/amd64 | - |" >> $GITHUB_STEP_SUMMARY
439+
echo "| CPU | ❌ Failed | linux/amd64,linux/arm64 | - |" >> $GITHUB_STEP_SUMMARY
307440
fi
308441
309442
# CUDA
@@ -322,9 +455,30 @@ jobs:
322455
323456
# Vulkan
324457
if [[ "${{ needs.build-vulkan.result }}" == "success" ]]; then
325-
echo "| Vulkan | ✅ Success | linux/amd64 | llama.cpp:vulkan-${{ needs.extract-version.outputs.version }} |" >> $GITHUB_STEP_SUMMARY
458+
echo "| Vulkan | ✅ Success | linux/amd64,linux/arm64 | llama.cpp:vulkan-${{ needs.extract-version.outputs.version }} |" >> $GITHUB_STEP_SUMMARY
459+
else
460+
echo "| Vulkan | ❌ Failed | linux/amd64,linux/arm64 | - |" >> $GITHUB_STEP_SUMMARY
461+
fi
462+
463+
# MUSA
464+
if [[ "${{ needs.build-musa.result }}" == "success" ]]; then
465+
echo "| MUSA | ✅ Success | linux/amd64 | llama.cpp:musa-${{ needs.extract-version.outputs.version }} |" >> $GITHUB_STEP_SUMMARY
466+
else
467+
echo "| MUSA | ❌ Failed | linux/amd64 | - |" >> $GITHUB_STEP_SUMMARY
468+
fi
469+
470+
# Intel
471+
if [[ "${{ needs.build-intel.result }}" == "success" ]]; then
472+
echo "| Intel | ✅ Success | linux/amd64 | llama.cpp:intel-${{ needs.extract-version.outputs.version }} |" >> $GITHUB_STEP_SUMMARY
473+
else
474+
echo "| Intel | ❌ Failed | linux/amd64 | - |" >> $GITHUB_STEP_SUMMARY
475+
fi
476+
477+
# CANN
478+
if [[ "${{ needs.build-cann.result }}" == "success" ]]; then
479+
echo "| CANN | ✅ Success | linux/amd64,linux/arm64 | llama.cpp:cann-${{ needs.extract-version.outputs.version }} |" >> $GITHUB_STEP_SUMMARY
326480
else
327-
echo "| Vulkan | ❌ Failed | linux/amd64 | - |" >> $GITHUB_STEP_SUMMARY
481+
echo "| CANN | ❌ Failed | linux/amd64,linux/arm64 | - |" >> $GITHUB_STEP_SUMMARY
328482
fi
329483
330484
echo "" >> $GITHUB_STEP_SUMMARY

0 commit comments

Comments
 (0)