Repository navigation
Expand file tree
/
Copy pathDockerfile
More file actions
67 lines (57 loc) · 2.27 KB
/
Copy pathDockerfile
File metadata and controls
67 lines (57 loc) · 2.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
ARG FEDORA_VERSION=44
ARG LLAMA_CPP_REF=master
FROM quay.io/fedora/fedora:${FEDORA_VERSION} AS builder
ARG LLAMA_CPP_REF
# Package lists and cmake flags mirror the "without containers" script in
# website/content/en/docs/config/vmtype/krunkit.md - keep the two in sync.
RUN dnf install -y \
git \
cmake \
clang \
curl-devel \
glslc \
spirv-headers-devel \
spirv-tools-devel \
vulkan-devel \
virglrenderer \
&& dnf clean all
WORKDIR /src
RUN git clone --depth 1 --branch "${LLAMA_CPP_REF}" https://github.com/ggml-org/llama.cpp .
# GGML_NATIVE=OFF keeps the binary portable across guest CPU feature sets.
RUN cmake -B build \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr \
-DGGML_VULKAN=ON \
-DGGML_CCACHE=OFF \
-DGGML_NATIVE=OFF \
&& cmake --build build --config Release -j"$(nproc)" \
&& DESTDIR=/out cmake --install build \
&& rm -rf /out/usr/include /out/usr/lib64/cmake /out/usr/lib64/pkgconfig
FROM quay.io/fedora/fedora:${FEDORA_VERSION}
ARG LLAMA_CPP_REF
RUN dnf install -y dnf-plugins-core \
&& dnf copr enable -y slp/mesa-libkrun-vulkan \
&& REPOID="copr:copr.fedorainfracloud.org:slp:mesa-libkrun-vulkan" \
&& MESA_VERSION="$(dnf repoquery -q --disablerepo='*' --enablerepo="$REPOID" --latest-limit=1 --qf '%{evr}' mesa-vulkan-drivers | head -1)" \
&& test -n "$MESA_VERSION" \
&& echo "Using patched Mesa ${MESA_VERSION} from ${REPOID}" \
&& dnf install -y \
"mesa-filesystem-${MESA_VERSION}" \
"mesa-dri-drivers-${MESA_VERSION}" \
"mesa-libgbm-${MESA_VERSION}" \
"mesa-libGL-${MESA_VERSION}" \
"mesa-va-drivers-${MESA_VERSION}" \
"mesa-vulkan-drivers-${MESA_VERSION}" \
vulkan-loader \
vulkan-tools \
&& dnf clean all
COPY --from=builder /out /
RUN ldconfig
# image.source is what links the GHCR package back to the repo and lets repo
# admins manage it.
LABEL org.opencontainers.image.title="fedora-vgpu-llama" \
org.opencontainers.image.description="llama.cpp with Vulkan on Venus/virtio-gpu, for Lima krunkit VMs" \
org.opencontainers.image.source="https://github.com/unsuman/fedora-vgpu-llama" \
org.opencontainers.image.licenses="Apache-2.0" \
org.opencontainers.image.version="${LLAMA_CPP_REF}"
CMD ["/bin/bash"]