Skip to content

Commit

Permalink
This should save some space
Browse files Browse the repository at this point in the history
All builds inherit just from the OS image. Helps save space as the
derived images just overwrite llama.cpp and whisper.cpp which is
wasteful.

Signed-off-by: Eric Curtin <ecurtin@redhat.com>
  • Loading branch information
ericcurtin committed Jan 8, 2025
1 parent aec0006 commit 96542a6
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 11 deletions.
2 changes: 1 addition & 1 deletion container-images/rocm/Containerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM quay.io/ramalama/ramalama:latest
FROM registry.access.redhat.com/ubi9/ubi:9.5

COPY rocm/amdgpu.repo /etc/yum.repos.d/
COPY rocm/rocm.repo /etc/yum.repos.d/
Expand Down
12 changes: 7 additions & 5 deletions container-images/scripts/build_llama_and_whisper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ dnf_install() {
"procps-ng" "git" "dnf-plugins-core")
local vulkan_rpms=("vulkan-headers" "vulkan-loader-devel" "vulkan-tools" \
"spirv-tools" "glslc" "glslang")
if [ "$containerfile" = "ramalama" ]; then

# All the UBI-based ones
if [ "$containerfile" = "ramalama" ] || [ "$containerfile" = "rocm" ] || \
[ "$containerfile" = "vulkan" ]; then
local url="https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm"
dnf install -y "$url"
crb enable # this is in epel-release, can only install epel-release via url
Expand All @@ -21,7 +24,9 @@ dnf_install() {
/etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-Official "$url"
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-Official
dnf install -y mesa-vulkan-drivers "${vulkan_rpms[@]}"
elif [ "$containerfile" = "asahi" ]; then
fi

if [ "$containerfile" = "asahi" ]; then
dnf copr enable -y @asahi/fedora-remix-branding
dnf install -y asahi-repos
dnf install -y mesa-vulkan-drivers "${vulkan_rpms[@]}" "${rpm_list[@]}"
Expand All @@ -32,9 +37,6 @@ dnf_install() {
# shellcheck disable=SC1091
. /opt/rh/gcc-toolset-12/enable
fi

# For Vulkan image, we don't need to install anything extra but rebuild with
# -DGGML_VULKAN
}

cmake_steps() {
Expand Down
2 changes: 1 addition & 1 deletion container-images/vulkan/Containerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM quay.io/ramalama/ramalama:latest
FROM registry.access.redhat.com/ubi9/ubi:9.5

COPY ../scripts /scripts
RUN chmod +x /scripts/*.sh && \
Expand Down
13 changes: 9 additions & 4 deletions container_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,14 @@ select_container_manager() {
}

add_build_platform() {
conman_build+=("build" "--no-cache" "--platform" "$platform")
conman_build+=("build")

# This build saves space
if ! $rm_after_build; then
conman_build+=("--no-cache")
fi

conman_build+=("--platform" "$platform")
conman_build+=("-t" "quay.io/ramalama/$image_name")
conman_build+=("-f" "$image_name/Containerfile" ".")
}
Expand Down Expand Up @@ -67,6 +74,7 @@ determine_platform() {
if [ "$(uname -m)" = "aarch64" ] || { [ "$(uname -s)" = "Darwin" ] && [ "$(uname -m)" = "arm64" ]; }; then
platform="linux/arm64"
fi

echo "$platform"
}

Expand Down Expand Up @@ -135,17 +143,14 @@ main() {
local command=""
local option=""
local rm_after_build="false"

parse_arguments "$@"

if [ -z "$command" ]; then
echo "Error: command is required (build or push)"
print_usage
exit 1
fi

target="${target:-all}"

if [ "$target" = "all" ]; then
process_all_targets "$command" "$option"
else
Expand Down

0 comments on commit 96542a6

Please sign in to comment.