@@ -2,10 +2,10 @@ ARG GCC_VERSION=15.2.0
22ARG UBUNTU_VERSION=24.04
33
44# ## Build Llama.cpp stage
5- FROM --platform=linux/s390x gcc:${GCC_VERSION} AS build
5+ FROM gcc:${GCC_VERSION} AS build
66
7- RUN --mount=type=cache,target=/var/cache/apt \
8- --mount=type=cache,target=/var/lib/apt/lists \
7+ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
8+ --mount=type=cache,target=/var/lib/apt/lists,sharing=locked \
99 apt update -y && \
1010 apt upgrade -y && \
1111 apt install -y --no-install-recommends \
@@ -24,8 +24,9 @@ RUN --mount=type=cache,target=/root/.ccache \
2424 -DCMAKE_C_COMPILER_LAUNCHER=ccache \
2525 -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
2626 -DLLAMA_BUILD_TESTS=OFF \
27- -DGGML_BACKEND_DL=OFF \
2827 -DGGML_NATIVE=OFF \
28+ -DGGML_BACKEND_DL=ON \
29+ -DGGML_CPU_ALL_VARIANTS=ON \
2930 -DGGML_BLAS=ON \
3031 -DGGML_BLAS_VENDOR=OpenBLAS && \
3132 cmake --build build --config Release -j $(nproc) && \
@@ -40,7 +41,7 @@ COPY requirements /opt/llama.cpp/gguf-py/requirements
4041
4142
4243# ## Collect all llama.cpp binaries, libraries and distro libraries
43- FROM --platform=linux/s390x scratch AS collector
44+ FROM scratch AS collector
4445
4546# Copy llama.cpp binaries and libraries
4647COPY --from=build /opt/llama.cpp/bin /llama.cpp/bin
@@ -49,13 +50,14 @@ COPY --from=build /opt/llama.cpp/gguf-py /llama.cpp/gguf-py
4950
5051
5152# ## Base image
52- FROM --platform=linux/s390x ubuntu:${UBUNTU_VERSION} AS base
53+ FROM ubuntu:${UBUNTU_VERSION} AS base
5354
54- RUN --mount=type=cache,target=/var/cache/apt \
55- --mount=type=cache,target=/var/lib/apt/lists \
55+ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
56+ --mount=type=cache,target=/var/lib/apt/lists,sharing=locked \
5657 apt update -y && \
5758 apt install -y --no-install-recommends \
5859 # WARNING: Do not use libopenblas-openmp-dev. libopenblas-dev is faster.
60+ # See: https://github.com/ggml-org/llama.cpp/pull/15915#issuecomment-3317166506
5961 curl libgomp1 libopenblas-dev && \
6062 apt autoremove -y && \
6163 apt clean -y && \
@@ -68,13 +70,13 @@ COPY --from=collector /llama.cpp/lib /usr/lib/s390x-linux-gnu
6870
6971
7072# ## Full
71- FROM --platform=linux/s390x base AS full
73+ FROM base AS full
7274
7375ENV PATH="/root/.cargo/bin:${PATH}"
7476WORKDIR /app
7577
76- RUN --mount=type=cache,target=/var/cache/apt \
77- --mount=type=cache,target=/var/lib/apt/lists \
78+ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
79+ --mount=type=cache,target=/var/lib/apt/lists,sharing=locked \
7880 apt update -y && \
7981 apt install -y \
8082 git cmake libjpeg-dev \
@@ -97,24 +99,26 @@ ENTRYPOINT [ "/app/tools.sh" ]
9799
98100
99101# ## CLI Only
100- FROM --platform=linux/s390x base AS light
102+ FROM base AS light
101103
102104WORKDIR /llama.cpp/bin
103105
104106# Copy llama.cpp binaries and libraries
107+ COPY --from=collector /llama.cpp/bin/*.so /llama.cpp/bin
105108COPY --from=collector /llama.cpp/bin/llama-cli /llama.cpp/bin
106109
107110ENTRYPOINT [ "/llama.cpp/bin/llama-cli" ]
108111
109112
110113# ## Server
111- FROM --platform=linux/s390x base AS server
114+ FROM base AS server
112115
113116ENV LLAMA_ARG_HOST=0.0.0.0
114117
115118WORKDIR /llama.cpp/bin
116119
117120# Copy llama.cpp binaries and libraries
121+ COPY --from=collector /llama.cpp/bin/*.so /llama.cpp/bin
118122COPY --from=collector /llama.cpp/bin/llama-server /llama.cpp/bin
119123
120124EXPOSE 8080
0 commit comments