Skip to content
Merged
Changes from 54 commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
bdcbcae
devops: add s390x dockerfile
taronaeo Sep 8, 2025
7584692
devops: add missing ninja
taronaeo Sep 8, 2025
955c426
devops: move s390x docker into cpu docker
taronaeo Sep 8, 2025
ce7bd19
devops: rework s390x docker
taronaeo Sep 8, 2025
e53e1c4
devops: copy more tools
taronaeo Sep 8, 2025
e172b00
devops: add server build step
taronaeo Sep 8, 2025
23d34f9
devops: remove apt clean steps as distroless misses it
taronaeo Sep 8, 2025
a070157
devops: remove apt commands from distroless
taronaeo Sep 8, 2025
2ff6694
devops: fix shared libs in distroless
taronaeo Sep 8, 2025
28b41f7
devops: use correct libs path
taronaeo Sep 8, 2025
3a09c65
devops: fix shared libs
taronaeo Sep 9, 2025
74767bb
devops: add collector stage
taronaeo Sep 9, 2025
7027c14
devops: fix missing stage ref
taronaeo Sep 9, 2025
c3ab785
devops: fix permission issue
taronaeo Sep 9, 2025
451aceb
devops: fix unknown model loading failures
taronaeo Sep 9, 2025
b23e72e
devops: attempt at fixing model loading failure
taronaeo Sep 9, 2025
944ef7f
devops: fix missing ggml shared object
taronaeo Sep 9, 2025
ab79c0b
devops: remove move shared objects
taronaeo Sep 9, 2025
10714ef
devops: move libggml-cpu and blas into bin
taronaeo Sep 9, 2025
f6baab6
devops: finalise hardened server stage
taronaeo Sep 9, 2025
a0b22c8
devops: add cli target
taronaeo Sep 9, 2025
489e0ab
devops: fix typos
taronaeo Sep 9, 2025
17a9985
devops: fix missing shared libraries in base
taronaeo Sep 9, 2025
244d6cf
devops: update debian target
taronaeo Sep 9, 2025
0a7664a
devops: formalise llama.cpp loc
taronaeo Sep 9, 2025
bff187d
Revert "devops: formalise llama.cpp loc"
taronaeo Sep 9, 2025
7367952
devops: formalise llama.cpp loc
taronaeo Sep 9, 2025
0084c88
devops: attempt at fixing missing dir
taronaeo Sep 9, 2025
03e642a
devops: attempt at making it cache the build
taronaeo Sep 9, 2025
a1912c7
devops: fix copying process
taronaeo Sep 9, 2025
4386989
devops: make build dir an argument
taronaeo Sep 9, 2025
ffcc751
Revert "devops: make build dir an argument"
taronaeo Sep 9, 2025
234ee29
devops: add build stage for gguf-py
taronaeo Sep 9, 2025
bd87c4e
devops: move gguf-py installation into build stage
taronaeo Sep 9, 2025
b205331
devops: break system packages?
taronaeo Sep 9, 2025
ec0f589
devops: add rust compiler installer
taronaeo Sep 9, 2025
7dd0db5
devops: fix rustc not found
taronaeo Sep 9, 2025
4da2807
devops: remove cache mount to allow rustc to persist
taronaeo Sep 9, 2025
9d01fa8
devops: move rustc installation to another layer
taronaeo Sep 9, 2025
67cf895
devops: move gguf-py installation to full stage, fix copying
taronaeo Sep 9, 2025
4d38065
devops: remove rustc installation in build
taronaeo Sep 9, 2025
a7432b7
devops: disable full target for now
taronaeo Sep 10, 2025
2e78ac0
devops: attempting static build
taronaeo Sep 10, 2025
712d751
devops: merge s390x dockerfile into cpu for now
taronaeo Sep 10, 2025
4d79a2d
devops: switch to gcc image for build step
taronaeo Sep 10, 2025
ff41f9f
devops: remove build essentials
taronaeo Sep 10, 2025
a6d850c
devops: install openblas into base target
taronaeo Sep 10, 2025
fd6ca73
devops: go back to s390x dockerfile
taronaeo Sep 10, 2025
2258d4b
devops: remove libggml and libblas
taronaeo Sep 10, 2025
3be2926
devops: add full target
taronaeo Sep 10, 2025
b3d3994
devops: add break system packages
taronaeo Sep 10, 2025
984771f
devops: add libjpeg
taronaeo Sep 10, 2025
557320c
devops: add missing cmake dep
taronaeo Sep 10, 2025
4f65e33
devops: finalise docker images for s390x
taronaeo Sep 10, 2025
5f66f7f
devops: add custom openblas patch
taronaeo Sep 20, 2025
d84f2cf
devops: use libopenblas-dev instead of libopenblas-openmp-dev
taronaeo Sep 22, 2025
c046eac
devops: add s390x docker build
taronaeo Sep 22, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
120 changes: 120 additions & 0 deletions .devops/s390x.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
ARG GCC_VERSION=15.2.0
ARG UBUNTU_VERSION=24.04

### Build stage
FROM --platform=linux/s390x gcc:${GCC_VERSION} AS build

RUN --mount=type=cache,target=/var/cache/apt \
--mount=type=cache,target=/var/lib/apt/lists \
apt update -y && \
apt upgrade -y && \
apt install -y --no-install-recommends \
git cmake ccache ninja-build \
libcurl4-openssl-dev libopenblas-openmp-dev && \
rm -rf /var/lib/apt/lists/*

WORKDIR /app
COPY . .

RUN --mount=type=cache,target=/root/.ccache \
--mount=type=cache,target=/app/build \
cmake -S . -B build -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DLLAMA_BUILD_TESTS=OFF \
-DGGML_BACKEND_DL=OFF \
-DGGML_NATIVE=OFF \
-DGGML_BLAS=ON \
-DGGML_BLAS_VENDOR=OpenBLAS && \
cmake --build build --config Release -j $(nproc) && \
cmake --install build --prefix /opt/llama.cpp

COPY *.py /opt/llama.cpp/bin
COPY .devops/tools.sh /opt/llama.cpp/bin

COPY gguf-py /opt/llama.cpp/gguf-py
COPY requirements.txt /opt/llama.cpp/gguf-py
COPY requirements /opt/llama.cpp/gguf-py/requirements


### Collect all llama.cpp binaries, libraries and distro libraries
FROM --platform=linux/s390x scratch AS collector

# Copy llama.cpp binaries and libraries
COPY --from=build /opt/llama.cpp/bin /llama.cpp/bin
COPY --from=build /opt/llama.cpp/lib /llama.cpp/lib
COPY --from=build /opt/llama.cpp/gguf-py /llama.cpp/gguf-py


### Base image
FROM --platform=linux/s390x ubuntu:${UBUNTU_VERSION} AS base

RUN --mount=type=cache,target=/var/cache/apt \
--mount=type=cache,target=/var/lib/apt/lists \
apt update -y && \
apt install -y --no-install-recommends \
curl libgomp1 libopenblas-dev && \
apt autoremove -y && \
apt clean -y && \
rm -rf /tmp/* /var/tmp/* && \
find /var/cache/apt/archives /var/lib/apt/lists -not -name lock -type f -delete && \
find /var/cache -type f -delete

# Copy llama.cpp libraries
COPY --from=collector /llama.cpp/lib /usr/lib/s390x-linux-gnu


### Full
FROM --platform=linux/s390x base AS full

ENV PATH="/root/.cargo/bin:${PATH}"
WORKDIR /app

RUN --mount=type=cache,target=/var/cache/apt \
--mount=type=cache,target=/var/lib/apt/lists \
apt update -y && \
apt install -y \
git cmake libjpeg-dev \
python3 python3-pip python3-dev && \
apt autoremove -y && \
apt clean -y && \
rm -rf /tmp/* /var/tmp/* && \
find /var/cache/apt/archives /var/lib/apt/lists -not -name lock -type f -delete && \
find /var/cache -type f -delete

RUN curl https://sh.rustup.rs -sSf | bash -s -- -y

COPY --from=collector /llama.cpp/bin /app
COPY --from=collector /llama.cpp/gguf-py /app/gguf-py

RUN pip install --no-cache-dir --break-system-packages \
-r /app/gguf-py/requirements.txt

ENTRYPOINT [ "/app/tools.sh" ]


### CLI Only
FROM --platform=linux/s390x base AS light

WORKDIR /llama.cpp/bin

# Copy llama.cpp binaries and libraries
COPY --from=collector /llama.cpp/bin/llama-cli /llama.cpp/bin

ENTRYPOINT [ "/llama.cpp/bin/llama-cli" ]


### Server
FROM --platform=linux/s390x base AS server

ENV LLAMA_ARG_HOST=0.0.0.0

WORKDIR /llama.cpp/bin

# Copy llama.cpp binaries and libraries
COPY --from=collector /llama.cpp/bin/llama-server /llama.cpp/bin

EXPOSE 8080

ENTRYPOINT [ "/llama.cpp/bin/llama-server" ]