-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: add vulkan images Signed-off-by: lstocchi <[email protected]> * fix: remove archs from name and convert dockerfile in multi-staged Signed-off-by: lstocchi <[email protected]> * fix: update image name Signed-off-by: lstocchi <[email protected]> * fix: merge all jobs into one Signed-off-by: lstocchi <[email protected]> --------- Signed-off-by: lstocchi <[email protected]>
- Loading branch information
Showing
7 changed files
with
160 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,14 +32,26 @@ env: | |
|
||
jobs: | ||
|
||
build: | ||
build_and_release: | ||
name: Build and Release ${{ matrix.build-image-name }} | ||
runs-on: ubuntu-22.04 | ||
|
||
strategy: | ||
matrix: | ||
include: | ||
- containerfile: "./chat/base/Containerfile" | ||
build-image-name: "ai-lab-playground-chat" | ||
archs: amd64, arm64 | ||
- containerfile: "./chat/vulkan/amd64/Containerfile" | ||
build-image-name: "ai-lab-playground-chat-vulkan" | ||
archs: amd64 | ||
- containerfile: "./chat/vulkan/arm64/Containerfile" | ||
build-image-name: "ai-lab-playground-chat-vulkan" | ||
archs: arm64 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.event.inputs.branch }} | ||
|
||
- name: Generate tag utilities | ||
id: TAG_UTIL | ||
run: | | ||
|
@@ -76,14 +88,14 @@ jobs: | |
id: build-image | ||
uses: redhat-actions/buildah-build@v2 | ||
with: | ||
image: ai-lab-playground-chat | ||
image: ${{ matrix.build-image-name }} | ||
tags: latest ${{ steps.TAG_UTIL.outputs.imageVersion }} ${{ steps.TAG_UTIL.outputs.imageVersionShort }} | ||
labels: io.podman.ai-lab.version=${{ steps.TAG_UTILS.outputs.imageVersion }} | ||
labels: io.podman.ai-lab.version=${{ steps.TAG_UTIL.outputs.imageVersion }} | ||
containerfiles: | | ||
./chat/Containerfile | ||
${{ matrix.containerfile }} | ||
context: ./chat | ||
oci: true | ||
archs: amd64, arm64 | ||
archs: ${{ matrix.archs }} | ||
|
||
- name: Login to ghcr.io | ||
uses: redhat-actions/podman-login@v1 | ||
|
@@ -99,14 +111,14 @@ jobs: | |
image: ${{ steps.build-image.outputs.image }} | ||
tags: ${{ steps.build-image.outputs.tags }} | ||
registry: ghcr.io/${{ github.repository_owner }}/podman-desktop-extension-ai-lab-playground-images | ||
|
||
- name: id | ||
run: echo the release id is ${{ needs.tag.outputs.releaseId}} | ||
run: echo the release id is ${{ steps.create_release.outputs.id}} | ||
|
||
- name: Publish release | ||
uses: StuYarrow/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
id: ${{ steps.create_release.outputs.id}} | ||
|
||
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
llama-cpp-python[server]==0.2.84 | ||
pip==24.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# | ||
# Copyright (C) 2024 Red Hat, Inc. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
# Stage 1: Build dependencies | ||
FROM registry.access.redhat.com/ubi9/python-311:1-66 AS builder | ||
USER 0 | ||
RUN dnf install -y python3-dnf-plugin-versionlock && \ | ||
dnf install -y mesa-vulkan-drivers-23.3.3-1.el9.x86_64 && \ | ||
dnf versionlock mesa-vulkan-drivers-23.3.3-1.el9.x86_64 && \ | ||
dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm && \ | ||
dnf install -y git cmake ninja-build gcc gcc-c++ && \ | ||
dnf copr enable -y ligenix/enterprise-sandbox epel-9-x86_64 && \ | ||
dnf install -y vulkan-headers vulkan-tools && \ | ||
dnf clean all | ||
|
||
WORKDIR /locallm | ||
COPY requirements.txt ./ | ||
RUN pip install --upgrade pip | ||
ENV CMAKE_ARGS="-DLLAMA_VULKAN=on" | ||
ENV FORCE_CMAKE=1 | ||
RUN pip install --target=/locallm --no-cache-dir --upgrade -r requirements.txt | ||
|
||
# Stage 2: Create final image with minimal content | ||
FROM registry.access.redhat.com/ubi9/python-311:1-66 | ||
COPY --from=builder /locallm/ /locallm | ||
COPY --from=builder /usr/bin/vkcube* /usr/bin/ | ||
COPY --from=builder /usr/bin/vulkaninfo /usr/bin/vulkaninfo | ||
COPY --from=builder /usr/lib/ /usr/lib/ | ||
COPY --from=builder /usr/lib64/ /usr/lib64/ | ||
COPY --from=builder /usr/share/vulkan /usr/share/vulkan | ||
COPY --from=builder /usr/include/vulkan /usr/include/vulkan | ||
COPY --from=builder /etc/ /etc/ | ||
USER 1001 | ||
WORKDIR /locallm | ||
COPY requirements.txt ./ | ||
COPY run.sh ./ | ||
ENTRYPOINT [ "sh", "run.sh" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# | ||
# Copyright (C) 2024 Red Hat, Inc. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
# Stage 1: Build dependencies | ||
FROM registry.access.redhat.com/ubi9/python-311:1-66 AS builder | ||
USER 0 | ||
WORKDIR /locallm | ||
RUN dnf install -y python3-dnf-plugin-versionlock && \ | ||
dnf install -y \ | ||
https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm && \ | ||
dnf copr enable -y slp/mesa-krunkit epel-9-aarch64 && \ | ||
dnf install -y mesa-vulkan-drivers-23.3.3-101.el9.aarch64 && \ | ||
dnf versionlock mesa-vulkan-drivers-23.3.3-101.el9.aarch64 && \ | ||
dnf install -y git cmake ninja-build gcc gcc-c++ vulkan-loader-devel vulkan-tools && \ | ||
dnf clean all | ||
COPY requirements.txt ./ | ||
RUN pip install --upgrade pip | ||
ENV CMAKE_ARGS="-DLLAMA_VULKAN=on" | ||
ENV FORCE_CMAKE=1 | ||
RUN pip install --target=/locallm --no-cache-dir --upgrade -r requirements.txt | ||
|
||
# Stage 2: Create final image with minimal content | ||
FROM registry.access.redhat.com/ubi9/python-311:1-66 | ||
COPY --from=builder /locallm/ /locallm | ||
COPY --from=builder /usr/bin/vkcube* /usr/bin/ | ||
COPY --from=builder /usr/bin/vulkaninfo /usr/bin/vulkaninfo | ||
COPY --from=builder /usr/lib/ /usr/lib/ | ||
COPY --from=builder /usr/lib64/libdrm* /usr/lib64/ | ||
COPY --from=builder /usr/lib64/libvulkan* /usr/lib64/ | ||
COPY --from=builder /usr/lib64/libVkLayer* /usr/lib64/ | ||
COPY --from=builder /usr/lib64/libxshmfence* /usr/lib64/ | ||
COPY --from=builder /usr/lib64/libwayland* /usr/lib64/ | ||
COPY --from=builder /usr/lib64/llvm16 /usr/lib64/llvm16 | ||
COPY --from=builder /usr/share/vulkan /usr/share/vulkan | ||
COPY --from=builder /usr/include/vulkan /usr/include/vulkan | ||
COPY --from=builder /etc/ /etc/ | ||
USER 1001 | ||
WORKDIR /locallm | ||
COPY run.sh ./ | ||
ENTRYPOINT [ "sh", "run.sh" ] |