Skip to content

Commit fd6ca73

Browse files
committed
devops: go back to s390x dockerfile
Signed-off-by: Aaron Teo <[email protected]>
1 parent a6d850c commit fd6ca73

File tree

1 file changed

+8
-46
lines changed

1 file changed

+8
-46
lines changed

.devops/s390x.Dockerfile

Lines changed: 8 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
ARG GCC_VERSION=15.2.0
2-
ARG DEBIAN_VERSION=12
2+
ARG UBUNTU_VERSION=24.04
33

44

55
FROM --platform=linux/s390x gcc:${GCC_VERSION} AS build
@@ -10,7 +10,6 @@ RUN --mount=type=cache,target=/var/cache/apt \
1010
apt upgrade -y && \
1111
apt install -y --no-install-recommends \
1212
git cmake ccache ninja-build \
13-
python3 python3-pip python3-dev \
1413
libcurl4-openssl-dev libopenblas-openmp-dev && \
1514
rm -rf /var/lib/apt/lists/*
1615

@@ -24,7 +23,7 @@ RUN --mount=type=cache,target=/root/.ccache \
2423
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
2524
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
2625
-DLLAMA_BUILD_TESTS=OFF \
27-
-DBUILD_SHARED_LIBS=OFF \
26+
-DGGML_BACKEND_DL=OFF \
2827
-DGGML_NATIVE=OFF \
2928
-DGGML_BLAS=ON \
3029
-DGGML_BLAS_VENDOR=OpenBLAS && \
@@ -51,16 +50,16 @@ COPY --from=build /opt/llama.cpp/lib /llama.cpp/lib
5150
COPY --from=build /opt/llama.cpp/gguf-py /llama.cpp/gguf-py
5251

5352
# Copy all shared libraries from distro
54-
COPY --from=build /usr/lib/s390x-linux-gnu /lib
53+
# COPY --from=build /usr/lib/s390x-linux-gnu /lib
5554

5655

57-
### Non-Hardened Base Target
58-
FROM --platform=linux/s390x debian:${DEBIAN_VERSION}-slim AS base
56+
### Base image
57+
FROM --platform=linux/s390x ubuntu:${UBUNTU_VERSION} AS base
5958

6059
RUN --mount=type=cache,target=/var/cache/apt \
6160
--mount=type=cache,target=/var/lib/apt/lists \
6261
apt update -y && \
63-
apt install -y libgomp1 curl && \
62+
apt install -y curl libgomp1 libopenblas-dev && \
6463
apt autoremove -y && \
6564
apt clean -y && \
6665
rm -rf /tmp/* /var/tmp/* && \
@@ -71,42 +70,12 @@ RUN --mount=type=cache,target=/var/cache/apt \
7170
COPY --from=collector /llama.cpp/lib /usr/lib/s390x-linux-gnu
7271

7372
# Copy all distro libraries
74-
COPY --from=collector /lib /lib/s390x-linux-gnu
75-
76-
77-
### Full
78-
# FROM base AS full
79-
80-
# USER root:root
81-
# WORKDIR /app
82-
83-
# # Fix rustc not found
84-
# ENV PATH="/root/.cargo/bin:${PATH}"
85-
86-
# COPY --from=collector /llama.cpp/bin /app
87-
# COPY --from=collector /llama.cpp/gguf-py /app/gguf-py
88-
89-
# RUN --mount=type=cache,target=/var/cache/apt \
90-
# --mount=type=cache,target=/var/lib/apt/lists \
91-
# apt update -y && \
92-
# apt install -y --no-install-recommends \
93-
# git python3 python3-pip python3-dev && \
94-
# apt autoremove -y && \
95-
# apt clean -y && \
96-
# rm -rf /tmp/* /var/tmp/* && \
97-
# find /var/cache/apt/archives /var/lib/apt/lists -not -name lock -type f -delete && \
98-
# find /var/cache -type f -delete
99-
100-
# RUN curl https://sh.rustup.rs -sSf | bash -s -- -y && \
101-
# pip install -r /app/gguf-py/requirements.txt
102-
103-
# ENTRYPOINT [ "/app/tools.sh" ]
73+
# COPY --from=collector /lib /lib/s390x-linux-gnu
10474

10575

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

109-
USER root:root
11079
WORKDIR /llama.cpp/bin
11180

11281
# Copy llama.cpp binaries and libraries
@@ -118,24 +87,17 @@ ENTRYPOINT [ "/llama.cpp/bin/llama-cli" ]
11887

11988

12089
### Hardened Server
121-
FROM --platform=linux/s390x gcr.io/distroless/cc-debian${DEBIAN_VERSION}:nonroot AS server
90+
FROM --platform=linux/s390x base AS server
12291

12392
ENV LLAMA_ARG_HOST=0.0.0.0
12493

125-
USER nonroot:nonroot
12694
WORKDIR /llama.cpp/bin
12795

12896
# Copy llama.cpp binaries and libraries
12997
COPY --from=collector /llama.cpp/bin/llama-server /llama.cpp/bin
130-
COPY --from=collector /llama.cpp/lib /usr/lib/s390x-linux-gnu
131-
132-
# Fixes model loading errors
13398
COPY --from=collector /llama.cpp/bin/libggml-cpu.so /llama.cpp/bin
13499
COPY --from=collector /llama.cpp/bin/libggml-blas.so /llama.cpp/bin
135100

136-
# Copy all distro libraries
137-
COPY --from=collector /lib /lib/s390x-linux-gnu
138-
139101
EXPOSE 8080
140102

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

0 commit comments

Comments
 (0)