From 21fc5339e75b07c48172a992eb6528d7024f833c Mon Sep 17 00:00:00 2001 From: Ettore Di Giacinto Date: Wed, 7 Jan 2026 16:33:46 +0100 Subject: [PATCH] chore(Dockerfile): restore GPU vendor specific sections Until we figure out https://github.com/mudler/LocalAI/issues/7909 Signed-off-by: Ettore Di Giacinto --- Dockerfile | 147 ++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 145 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index d3521a74e32f..4f1c125548f0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,11 +14,152 @@ RUN apt-get update && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* +# The requirements-drivers target is for BUILD_TYPE specific items. If you need to install something specific to CUDA, or specific to ROCM, it goes here. +FROM requirements AS requirements-drivers + +ARG BUILD_TYPE +ARG CUDA_MAJOR_VERSION=12 +ARG CUDA_MINOR_VERSION=0 +ARG SKIP_DRIVERS=false +ARG TARGETARCH +ARG TARGETVARIANT +ENV BUILD_TYPE=${BUILD_TYPE} +ARG UBUNTU_VERSION=2404 + +RUN mkdir -p /run/localai +RUN echo "default" > /run/localai/capability + +# Vulkan requirements +RUN < /run/localai/capability + fi +EOT + +# CuBLAS requirements +RUN < /run/localai/capability + fi +EOT + +RUN < /run/localai/capability + fi +EOT + +# https://github.com/NVIDIA/Isaac-GR00T/issues/343 +RUN < /run/localai/capability && \ + # I have no idea why, but the ROCM lib packages don't trigger ldconfig after they install, which results in local-ai and others not being able + # to locate the libraries. We run ldconfig ourselves to work around this packaging deficiency + ldconfig \ + ; fi + +RUN if [ "${BUILD_TYPE}" = "hipblas" ]; then \ + ln -s /opt/rocm-**/lib/llvm/lib/libomp.so /usr/lib/libomp.so \ + ; fi + +RUN expr "${BUILD_TYPE}" = intel && echo "intel" > /run/localai/capability || echo "not intel" + +# Cuda +ENV PATH=/usr/local/cuda/bin:${PATH} + +# HipBLAS requirements +ENV PATH=/opt/rocm/bin:${PATH} + ################################### ################################### # The requirements-core target is common to all images. It should not be placed in requirements-core unless every single build will use it. -FROM requirements AS build-requirements +FROM requirements-drivers AS build-requirements ARG GO_VERSION=1.25.4 ARG CMAKE_VERSION=3.31.10 @@ -70,6 +211,8 @@ RUN echo "Target Architecture: $TARGETARCH" RUN echo "Target Variant: $TARGETVARIANT" + + WORKDIR /build @@ -190,7 +333,7 @@ RUN go install github.com/mikefarah/yq/v4@latest # This is the final target. The result of this target will be the image uploaded to the registry. # If you cannot find a more suitable place for an addition, this layer is a suitable place for it. -FROM requirements +FROM requirements-drivers ENV HEALTHCHECK_ENDPOINT=http://localhost:8080/readyz