Skip to content

Commit bb0e507

Browse files
committed
base image dockerfiles for cuda, cpu and rocm
1 parent 2df255d commit bb0e507

File tree

4 files changed

+51
-1615
lines changed

4 files changed

+51
-1615
lines changed

.devops/cpu.Dockerfile

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,28 @@ ARG TARGETARCH
77
ARG GGML_CPU_ARM_ARCH=armv8-a
88

99
RUN apt-get update && \
10-
apt-get install -y build-essential git cmake libcurl4-openssl-dev
10+
apt-get install -y build-essential \
11+
git \
12+
cmake \
13+
libcurl4-openssl-dev \
14+
libssl-dev
1115

1216
WORKDIR /app
1317

1418
COPY . .
1519

16-
RUN if [ "$TARGETARCH" = "amd64" ]; then \
17-
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DGGML_NATIVE=OFF -DLLAMA_BUILD_TESTS=OFF -DGGML_BACKEND_DL=ON -DGGML_CPU_ALL_VARIANTS=ON; \
18-
elif [ "$TARGETARCH" = "arm64" ]; then \
19-
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DGGML_NATIVE=OFF -DLLAMA_BUILD_TESTS=OFF -DGGML_CPU_ARM_ARCH=${GGML_CPU_ARM_ARCH}; \
20-
else \
21-
echo "Unsupported architecture"; \
22-
exit 1; \
23-
fi && \
20+
RUN cmake -S . -B build \
21+
-DCMAKE_BUILD_TYPE=Release \
22+
-DGGML_NATIVE=OFF \
23+
-DLLAMA_BUILD_TESTS=OFF \
24+
-DGGML_BACKEND_DL=ON \
25+
-DGGML_CPU_ALL_VARIANTS=ON \
26+
-DLLAMA_BUILD_SERVER=ON \
27+
-DLLAMA_BUILD_EXAMPLES=OFF \
28+
-DLLAMA_SERVER_SSL=ON && \
2429
cmake --build build -j $(nproc)
2530

31+
2632
RUN mkdir -p /app/lib && \
2733
find build -name "*.so" -exec cp {} /app/lib \;
2834

.devops/cuda.Dockerfile

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ FROM ${BASE_CUDA_DEV_CONTAINER} AS build
1212
ARG CUDA_DOCKER_ARCH=default
1313

1414
RUN apt-get update && \
15-
apt-get install -y build-essential cmake python3 python3-pip git libcurl4-openssl-dev libgomp1
15+
apt-get install -y build-essential cmake python3 python3-pip git libcurl4-openssl-dev libgomp1 libssl-dev
1616

1717
WORKDIR /app
1818

@@ -21,7 +21,14 @@ COPY . .
2121
RUN if [ "${CUDA_DOCKER_ARCH}" != "default" ]; then \
2222
export CMAKE_ARGS="-DCMAKE_CUDA_ARCHITECTURES=${CUDA_DOCKER_ARCH}"; \
2323
fi && \
24-
cmake -B build -DGGML_NATIVE=OFF -DGGML_CUDA=ON -DGGML_BACKEND_DL=ON -DGGML_CPU_ALL_VARIANTS=ON -DLLAMA_BUILD_TESTS=OFF ${CMAKE_ARGS} -DCMAKE_EXE_LINKER_FLAGS=-Wl,--allow-shlib-undefined . && \
24+
cmake -B build \
25+
-DGGML_NATIVE=OFF \
26+
-DGGML_CUDA=ON \
27+
-DGGML_BACKEND_DL=ON \
28+
-DGGML_CPU_ALL_VARIANTS=ON \
29+
-DLLAMA_BUILD_EXAMPLES=OFF \
30+
-DLLAMA_SERVER_SSL=ON \
31+
-DLLAMA_BUILD_TESTS=OFF ${CMAKE_ARGS} -DCMAKE_EXE_LINKER_FLAGS=-Wl,--allow-shlib-undefined . && \
2532
cmake --build build --config Release -j$(nproc)
2633

2734
RUN mkdir -p /app/lib && \

.devops/rocm.Dockerfile

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,23 @@ RUN apt-get update \
3333
git \
3434
libcurl4-openssl-dev \
3535
curl \
36-
libgomp1
36+
libgomp1 \
37+
libssl-dev
3738

3839
WORKDIR /app
3940

4041
COPY . .
4142

4243
RUN HIPCXX="$(hipconfig -l)/clang" HIP_PATH="$(hipconfig -R)" \
43-
cmake -S . -B build -DGGML_HIP=ON -DAMDGPU_TARGETS=$ROCM_DOCKER_ARCH -DGGML_BACKEND_DL=ON -DGGML_CPU_ALL_VARIANTS=ON -DCMAKE_BUILD_TYPE=Release -DLLAMA_BUILD_TESTS=OFF \
44+
cmake -S . -B build \
45+
-DGGML_HIP=ON \
46+
-DAMDGPU_TARGETS=$ROCM_DOCKER_ARCH \
47+
-DGGML_BACKEND_DL=ON \
48+
-DGGML_CPU_ALL_VARIANTS=ON \
49+
-DCMAKE_BUILD_TYPE=Release \
50+
-DLLAMA_BUILD_EXAMPLES=OFF \
51+
-DLLAMA_SERVER_SSL=ON \
52+
-DLLAMA_BUILD_TESTS=OFF \
4453
&& cmake --build build --config Release -j$(nproc)
4554

4655
RUN mkdir -p /app/lib \

0 commit comments

Comments
 (0)