-
Notifications
You must be signed in to change notification settings - Fork 13.7k
devops: add s390x containers #15915
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
devops: add s390x containers #15915
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 7584692
devops: add missing ninja
taronaeo 955c426
devops: move s390x docker into cpu docker
taronaeo ce7bd19
devops: rework s390x docker
taronaeo e53e1c4
devops: copy more tools
taronaeo e172b00
devops: add server build step
taronaeo 23d34f9
devops: remove apt clean steps as distroless misses it
taronaeo a070157
devops: remove apt commands from distroless
taronaeo 2ff6694
devops: fix shared libs in distroless
taronaeo 28b41f7
devops: use correct libs path
taronaeo 3a09c65
devops: fix shared libs
taronaeo 74767bb
devops: add collector stage
taronaeo 7027c14
devops: fix missing stage ref
taronaeo c3ab785
devops: fix permission issue
taronaeo 451aceb
devops: fix unknown model loading failures
taronaeo b23e72e
devops: attempt at fixing model loading failure
taronaeo 944ef7f
devops: fix missing ggml shared object
taronaeo ab79c0b
devops: remove move shared objects
taronaeo 10714ef
devops: move libggml-cpu and blas into bin
taronaeo f6baab6
devops: finalise hardened server stage
taronaeo a0b22c8
devops: add cli target
taronaeo 489e0ab
devops: fix typos
taronaeo 17a9985
devops: fix missing shared libraries in base
taronaeo 244d6cf
devops: update debian target
taronaeo 0a7664a
devops: formalise llama.cpp loc
taronaeo bff187d
Revert "devops: formalise llama.cpp loc"
taronaeo 7367952
devops: formalise llama.cpp loc
taronaeo 0084c88
devops: attempt at fixing missing dir
taronaeo 03e642a
devops: attempt at making it cache the build
taronaeo a1912c7
devops: fix copying process
taronaeo 4386989
devops: make build dir an argument
taronaeo ffcc751
Revert "devops: make build dir an argument"
taronaeo 234ee29
devops: add build stage for gguf-py
taronaeo bd87c4e
devops: move gguf-py installation into build stage
taronaeo b205331
devops: break system packages?
taronaeo ec0f589
devops: add rust compiler installer
taronaeo 7dd0db5
devops: fix rustc not found
taronaeo 4da2807
devops: remove cache mount to allow rustc to persist
taronaeo 9d01fa8
devops: move rustc installation to another layer
taronaeo 67cf895
devops: move gguf-py installation to full stage, fix copying
taronaeo 4d38065
devops: remove rustc installation in build
taronaeo a7432b7
devops: disable full target for now
taronaeo 2e78ac0
devops: attempting static build
taronaeo 712d751
devops: merge s390x dockerfile into cpu for now
taronaeo 4d79a2d
devops: switch to gcc image for build step
taronaeo ff41f9f
devops: remove build essentials
taronaeo a6d850c
devops: install openblas into base target
taronaeo fd6ca73
devops: go back to s390x dockerfile
taronaeo 2258d4b
devops: remove libggml and libblas
taronaeo 3be2926
devops: add full target
taronaeo b3d3994
devops: add break system packages
taronaeo 984771f
devops: add libjpeg
taronaeo 557320c
devops: add missing cmake dep
taronaeo 4f65e33
devops: finalise docker images for s390x
taronaeo 5f66f7f
devops: add custom openblas patch
taronaeo d84f2cf
devops: use libopenblas-dev instead of libopenblas-openmp-dev
taronaeo c046eac
devops: add s390x docker build
taronaeo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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" ] | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.