Update comfyui-rocm-dockerfile
This commit is contained in:
1 parent
2e8e59be64
commit
024e1e769a
1 file changed
+18
-55
+18
-55
@@ -1,6 +1,7 @@
|
|||||||
FROM ubuntu:24.04 AS mesa-builder
|
FROM ubuntu:24.04 AS builder
|
||||||
ENV DEBIAN_FRONTEND=noninteractive
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
|
#install build deps
|
||||||
RUN apt-get update && apt-get install -y \
|
RUN apt-get update && apt-get install -y \
|
||||||
git \
|
git \
|
||||||
python3-mako \
|
python3-mako \
|
||||||
@@ -33,36 +34,25 @@ RUN apt-get update && apt-get install -y \
|
|||||||
libx11-dev \
|
libx11-dev \
|
||||||
libxcb-shm0-dev \
|
libxcb-shm0-dev \
|
||||||
libxrandr-dev \
|
libxrandr-dev \
|
||||||
git \
|
|
||||||
python3-mako \
|
|
||||||
python3-yaml \
|
|
||||||
python3-packaging \
|
|
||||||
python3-pip \
|
python3-pip \
|
||||||
ninja-build \
|
curl \
|
||||||
build-essential \
|
wget \
|
||||||
pkg-config \
|
golang-go \
|
||||||
flex \
|
ca-certificates \
|
||||||
bison \
|
vulkan-tools \
|
||||||
libpciaccess-dev \
|
spirv-headers \
|
||||||
libexpat1-dev \
|
libshaderc-dev \
|
||||||
libelf-dev \
|
glslc \
|
||||||
libvulkan-dev \
|
|
||||||
glslang-tools \
|
|
||||||
spirv-tools \
|
|
||||||
llvm-dev \
|
|
||||||
libclang-dev \
|
|
||||||
cmake \
|
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
RUN pip3 install --no-cache-dir --break-system-packages --upgrade meson
|
RUN pip3 install --no-cache-dir --break-system-packages --upgrade meson
|
||||||
|
|
||||||
# Build required newer libdrm from source
|
# Build libdrm
|
||||||
RUN git clone --depth 1 https://gitlab.freedesktop.org/mesa/drm.git /drm
|
RUN git clone --depth 1 https://gitlab.freedesktop.org/mesa/drm.git /drm
|
||||||
WORKDIR /drm
|
WORKDIR /drm
|
||||||
RUN meson setup build -Dbuildtype=release -Dprefix=/opt/mesa
|
RUN meson setup build -Dbuildtype=release -Dprefix=/opt/mesa
|
||||||
RUN ninja -C build -j16 && ninja -C build install
|
RUN ninja -C build -j16 && ninja -C build install
|
||||||
|
|
||||||
# Build matching LLVMSPIRVLib (SPIRV-LLVM-Translator) for LLVM 18
|
# Build LLVMSPIRVLib
|
||||||
RUN git clone --branch llvm_release_180 --depth 1 https://github.com/KhronosGroup/SPIRV-LLVM-Translator.git /spirv-llvm-translator
|
RUN git clone --branch llvm_release_180 --depth 1 https://github.com/KhronosGroup/SPIRV-LLVM-Translator.git /spirv-llvm-translator
|
||||||
WORKDIR /spirv-llvm-translator
|
WORKDIR /spirv-llvm-translator
|
||||||
RUN cmake -B build \
|
RUN cmake -B build \
|
||||||
@@ -72,54 +62,27 @@ RUN cmake -B build \
|
|||||||
RUN cmake --build build --parallel 16
|
RUN cmake --build build --parallel 16
|
||||||
RUN cmake --install build
|
RUN cmake --install build
|
||||||
|
|
||||||
# Build Mesa-git pointing to the custom libdrm and LLVMSPIRVLib paths
|
# Build Mesa-git
|
||||||
RUN git clone --depth 1 https://gitlab.freedesktop.org/mesa/mesa.git /mesa
|
RUN git clone --depth 1 https://gitlab.freedesktop.org/mesa/mesa.git /mesa
|
||||||
WORKDIR /mesa
|
WORKDIR /mesa
|
||||||
|
|
||||||
ENV PKG_CONFIG_PATH=/opt/mesa/lib/pkgconfig:/opt/mesa/lib/aarch64-linux-gnu/pkgconfig:$PKG_CONFIG_PATH
|
ENV PKG_CONFIG_PATH=/opt/mesa/lib/pkgconfig:/opt/mesa/lib/aarch64-linux-gnu/pkgconfig:$PKG_CONFIG_PATH
|
||||||
ENV CMAKE_PREFIX_PATH=/opt/mesa:$CMAKE_PREFIX_PATH
|
ENV CMAKE_PREFIX_PATH=/opt/mesa:$CMAKE_PREFIX_PATH
|
||||||
|
|
||||||
RUN meson setup build \
|
RUN meson setup build \
|
||||||
-Dbuildtype=release \
|
-Dbuildtype=release \
|
||||||
-Dgallium-drivers= \
|
-Dgallium-drivers= \
|
||||||
-Dvulkan-drivers=amd \
|
-Dvulkan-drivers=amd \
|
||||||
-Dplatforms=x11,wayland \
|
-Dplatforms=x11,wayland \
|
||||||
-Dprefix=/opt/mesa
|
-Dprefix=/opt/mesa
|
||||||
|
|
||||||
RUN ninja -C build --verbose
|
RUN ninja -C build --verbose
|
||||||
RUN ninja -C build install
|
RUN ninja -C build install
|
||||||
|
|
||||||
# Stage 2: Build Ollama with Vulkan support
|
# Build Ollama
|
||||||
FROM ubuntu:24.04 AS ollama-builder
|
RUN git clone --recursive https://github.com/ollama/ollama.git /app
|
||||||
ENV DEBIAN_FRONTEND=noninteractive
|
|
||||||
|
|
||||||
RUN apt-get update && apt-get install -y \
|
|
||||||
build-essential \
|
|
||||||
git \
|
|
||||||
curl \
|
|
||||||
wget \
|
|
||||||
cmake \
|
|
||||||
golang-go \
|
|
||||||
ca-certificates \
|
|
||||||
ninja-build \
|
|
||||||
libvulkan-dev \
|
|
||||||
vulkan-tools \
|
|
||||||
glslang-tools \
|
|
||||||
spirv-headers \
|
|
||||||
spirv-tools \
|
|
||||||
libshaderc-dev \
|
|
||||||
glslc \
|
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
RUN git clone --recursive https://github.com/ollama/ollama.git .
|
|
||||||
|
|
||||||
# Configure and compile Ollama using the Vulkan backend
|
|
||||||
RUN cmake -B build . \
|
RUN cmake -B build . \
|
||||||
-DOLLAMA_LLAMA_BACKENDS="vulkan" \
|
-DOLLAMA_LLAMA_BACKENDS="vulkan" \
|
||||||
-DGGML_VULKAN=ON \
|
-DGGML_VULKAN=ON \
|
||||||
-DCMAKE_BUILD_TYPE=Release
|
-DCMAKE_BUILD_TYPE=Release
|
||||||
|
|
||||||
RUN cmake --build build --parallel 16
|
RUN cmake --build build --parallel 16
|
||||||
RUN go build -o ollama .
|
RUN go build -o ollama .
|
||||||
|
|
||||||
@@ -138,11 +101,11 @@ RUN apt-get update && apt-get install -y \
|
|||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# Copy compiled Mesa-git libraries and ICD files from Stage 1
|
# Copy compiled Mesa-git libraries and ICD files from Stage 1
|
||||||
COPY --from=mesa-builder /opt/mesa /opt/mesa
|
COPY --from=builder /opt/mesa /opt/mesa
|
||||||
|
|
||||||
# Copy compiled Ollama binary from Stage 2
|
# Copy compiled Ollama binary from Stage 2
|
||||||
COPY --from=ollama-builder /app/ollama /app/ollama
|
COPY --from=builder /app/ollama /app/ollama
|
||||||
COPY --from=ollama-builder /app/build /app/build
|
COPY --from=builder /app/build /app/build
|
||||||
|
|
||||||
EXPOSE 11434
|
EXPOSE 11434
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user