From 4d209b92f42c57010302be5f1aa2bb11c543c408 Mon Sep 17 00:00:00 2001 From: Daniel J Walsh Date: Fri, 14 Feb 2025 10:12:03 -0500 Subject: [PATCH] Add entrypoint container images Install podman-remote and ramalama so we can use ramalama from within a container. $ podman run --env XDG_RUNTIME_DIR -v $HOME:$HOME -v /run/user:/run/user --userns=keep-id -ti --privileged quay.io/ramalama/ramalama ramalama run granite Signed-off-by: Daniel J Walsh --- .../scripts/build_llama_and_whisper.sh | 16 +++++++++++++++- container_build.sh | 18 ++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/container-images/scripts/build_llama_and_whisper.sh b/container-images/scripts/build_llama_and_whisper.sh index 1ada9a9c..0a38a867 100755 --- a/container-images/scripts/build_llama_and_whisper.sh +++ b/container-images/scripts/build_llama_and_whisper.sh @@ -15,7 +15,7 @@ dnf_install_intel_gpu() { } dnf_install() { - local rpm_list=("python3" "python3-pip" "python3-argcomplete" \ + local rpm_list=("podman-remote" "python3" "python3-pip" "python3-argcomplete" \ "python3-dnf-plugin-versionlock" "gcc-c++" "cmake" "vim" \ "procps-ng" "git" "dnf-plugins-core" "libcurl-devel") local vulkan_rpms=("vulkan-headers" "vulkan-loader-devel" "vulkan-tools" \ @@ -122,6 +122,17 @@ clone_and_build_llama_cpp() { rm -rf llama.cpp } +clone_and_build_ramalama() { + # link podman-remote to podman for use by RamaLama + ln -sf /usr/bin/podman-remote /usr/bin/podman + git clone https://github.com/containers/ramalama + cd ramalama + git submodule update --init --recursive + pip install . --prefix=/usr + cd .. + rm -rf ramalama +} + main() { set -ex @@ -134,6 +145,9 @@ main() { configure_common_flags common_flags+=("-DGGML_CCACHE=OFF" "-DCMAKE_INSTALL_PREFIX=$install_prefix") available dnf && dnf_install + if [ -n "$containerfile" ]; then + clone_and_build_ramalama + fi clone_and_build_whisper_cpp common_flags+=("-DLLAMA_CURL=ON") case "$containerfile" in diff --git a/container_build.sh b/container_build.sh index 29648adb..9156c50c 100755 --- a/container_build.sh +++ b/container_build.sh @@ -37,6 +37,22 @@ rm_container_image() { fi } +add_entrypoint() { + containerfile=$(mktemp) + cat > ${containerfile} <