diff --git a/.github/workflows/build-stack.yaml b/.github/workflows/build-stack.yaml new file mode 100644 index 0000000..bca1a7c --- /dev/null +++ b/.github/workflows/build-stack.yaml @@ -0,0 +1,79 @@ +# +# Copyright (C) 2025 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 + +name: build-stack + +on: + push: + branches: + - 'main' + +jobs: + publish: + name: publish + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@v4 + + - name: Update podman + run: | + # ubuntu version from kubic repository to install podman we need (v5) + ubuntu_version='23.10' + sudo sh -c "echo 'deb https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/unstable/xUbuntu_${ubuntu_version}/ /' > /etc/apt/sources.list.d/devel:kubic:libcontainers:unstable.list" + curl -L "https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/unstable/xUbuntu_${ubuntu_version}/Release.key" | sudo apt-key add - + # install necessary dependencies for criu package which is not part of 23.10 + sudo apt-get install -qq libprotobuf32t64 python3-protobuf libnet1 + # install criu manually from static location + curl -sLO http://cz.archive.ubuntu.com/ubuntu/pool/universe/c/criu/criu_3.16.1-2_amd64.deb && sudo dpkg -i criu_3.16.1-2_amd64.deb + sudo apt-get update -qq + sudo apt-get -qq -y install podman || { echo "Start fallback steps for podman nightly installation from a static mirror" && \ + sudo sh -c "echo 'deb http://ftp.lysator.liu.se/pub/opensuse/repositories/devel:/kubic:/libcontainers:/unstable/xUbuntu_${ubuntu_version}/ /' > /etc/apt/sources.list.d/devel:kubic:libcontainers:unstable.list" && \ + curl -L "http://ftp.lysator.liu.se/pub/opensuse/repositories/devel:/kubic:/libcontainers:/unstable/xUbuntu_${ubuntu_version}/Release.key" | sudo apt-key add - && \ + sudo apt-get update && \ + sudo apt-get -y install podman; } + podman version + - name: Revert unprivileged user namespace restrictions in Ubuntu 24.04 + run: | + # allow unprivileged user namespace + sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0 + - name: Set cgroup_manager to 'cgroupfs' instead of systemd + run: | + mkdir -p ~/.config/containers + cat <> ~/.config/containers/containers.conf + [engine] + cgroup_manager="cgroupfs" + EOT + podman info + + - name: build package + run: | + pip install --upgrade build + python -m build + + - name: Login to ghcr.io + run: podman login --username ${{ github.repository_owner }} --password ${{ secrets.GITHUB_TOKEN }} ghcr.io + + - name: Publish Image + id: publish-image + run: | + IMAGE_NAME=ghcr.io/${{ github.repository_owner }}/podman-ai-lab-stack + IMAGE_NIGHTLY=${IMAGE_NAME}:nightly + IMAGE_SHA=${IMAGE_NAME}:${GITHUB_SHA} + podman build . -f build/Containerfile -t $IMAGE_NIGHTLY + podman push $IMAGE_NIGHTLY + podman tag $IMAGE_NIGHTLY $IMAGE_SHA + podman push $IMAGE_SHA diff --git a/build/Containerfile b/build/Containerfile index ed282ce..9323f84 100644 --- a/build/Containerfile +++ b/build/Containerfile @@ -1,7 +1,10 @@ FROM registry.access.redhat.com/ubi9/python-311:1-77.1726664316 -RUN pip install fastapi -RUN pip install --extra-index-url https://test.pypi.org/simple/ podman-ai-lab-stack==0.11.0 +WORKDIR /opt/app-root/src + +COPY dist dist + +RUN pip install ./dist/podman_ai_lab_stack-0.12.0.tar.gz RUN \ mkdir -p $HOME/.llama/providers.d/remote/inference && \ cp /opt/app-root/lib64/python3.11/site-packages/podman_ai_lab_stack/providers.d/remote/inference/podman-ai-lab.yaml \ diff --git a/pyproject.toml b/pyproject.toml index 9592b90..caea5aa 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "podman-ai-lab-stack" -version = "0.11.0" +version = "0.12.0" description = "Podman AI Lab provider for Llama Stack" requires-python = ">=3.10" dynamic = ["dependencies"] diff --git a/src/podman_ai_lab_stack/run.yaml b/src/podman_ai_lab_stack/run.yaml index 875cce9..9e6fbca 100644 --- a/src/podman_ai_lab_stack/run.yaml +++ b/src/podman_ai_lab_stack/run.yaml @@ -15,7 +15,7 @@ providers: - provider_id: podman-ai-lab provider_type: remote::podman-ai-lab config: - url: ${env.PODMAN_AI_LAB_URL:http://localhost:10434} + url: ${env.PODMAN_AI_LAB_URL:http://host.containers.internal:10434} vector_io: - provider_id: faiss provider_type: inline::faiss