-
Notifications
You must be signed in to change notification settings - Fork 101
Expand file tree
/
Copy pathcann.Dockerfile
More file actions
49 lines (37 loc) · 1.43 KB
/
cann.Dockerfile
File metadata and controls
49 lines (37 loc) · 1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# syntax=docker/dockerfile:1
ARG CANN_VERSION=8.0.0-910b
ARG CANN_IMAGE_VARIANT=openeuler22.03
FROM quay.io/ascend/cann:${CANN_VERSION}-${CANN_IMAGE_VARIANT}-py3.10 AS builder
ARG TARGETARCH
ARG CANN_IMAGE_VARIANT
RUN apt-get update && apt-get install -y cmake ninja-build git build-essential curl
WORKDIR /llama-server
COPY .git .git
COPY llamacpp/native/CMakeLists.txt .
COPY llamacpp/native/src src
COPY llamacpp/native/vendor vendor
# Fix submodule .git file to point to correct location in container
RUN echo "gitdir: ../../.git/modules/llamacpp/native/vendor/llama.cpp" > vendor/llama.cpp/.git && \
sed -i 's|worktree = ../../../../../../llamacpp/native/vendor/llama.cpp|worktree = /llama-server/vendor/llama.cpp|' .git/modules/llamacpp/native/vendor/llama.cpp/config
RUN echo "-B build \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=ON \
-DGGML_BACKEND_DL=ON \
-DGGML_CPU_ALL_VARIANTS=ON \
-DGGML_NATIVE=OFF \
-DGGML_OPENMP=OFF \
-DGGML_CANN=ON \
-DLLAMA_CURL=OFF \
-GNinja \
-S ." > cmake-flags
RUN cmake $(cat cmake-flags)
RUN cmake --build build --config Release
RUN cmake --install build --config Release --prefix install
RUN rm install/bin/*.py
RUN rm -r install/lib/cmake
RUN rm -r install/lib/pkgconfig
RUN rm -r install/include
FROM scratch AS final
ARG TARGETARCH
ARG CANN_VERSION
COPY --from=builder /llama-server/install /com.docker.llama-server.native.linux.cann$CANN_VERSION.$TARGETARCH