char-fork/llama.cpp
git clone https://git.t4t.associates/char-fork/llama.cpp
5d8ccdf9d
char/aliceai-t5-moe
1ARG UBUNTU_VERSION=24.04 2ARG BUILD_DATE=N/A 3ARG APP_VERSION=N/A 4ARG APP_REVISION=N/A 5 6ARG NODE_VERSION=24 7 8FROM docker.io/node: $ NODE_VERSION AS web 9 10ARG APP_VERSION 11 12WORKDIR /app/tools/ui 13 14COPY tools/ui/package.json tools/ui/package-lock.json ./ 15RUN npm ci 16 17COPY tools/ui/ ./ 18RUN LLAMA_BUILD_NUMBER="$APP_VERSION" npm run build 19 20FROM docker.io/ubuntu: $ UBUNTU_VERSION AS build 21 22ARG TARGETARCH 23 24RUN apt-get update && \ 25 apt-get install -y gcc-14 g++-14 build-essential git cmake libssl-dev 26 27ENV CC=gcc-14 CXX=g++-14 28 29WORKDIR /app 30 31COPY . . 32 33COPY --from=web /app/tools/ui/dist tools/ui/dist 34 35RUN if [ "$TARGETARCH" = "amd64" ] || [ "$TARGETARCH" = "arm64" ]; then \ 36 cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DGGML_NATIVE=OFF -DLLAMA_BUILD_TESTS=OFF -DGGML_BACKEND_DL=ON -DGGML_CPU_ALL_VARIANTS=ON; \ 37 else \ 38 echo "Unsupported architecture"; \ 39 exit 1; \ 40 fi && \ 41 cmake --build build -j $(nproc) 42 43RUN mkdir -p /app/lib && \ 44 find build -name "*.so*" -exec cp -P {} /app/lib \; 45 46RUN mkdir -p /app/full \ 47 && cp build/bin/* /app/full \ 48 && cp *.py /app/full \ 49 && cp -r conversion /app/full \ 50 && cp -r gguf-py /app/full \ 51 && cp -r requirements /app/full \ 52 && cp requirements.txt /app/full \ 53 && cp .devops/tools.sh /app/full/tools.sh 54 55## Base image 56FROM docker.io/ubuntu: $ UBUNTU_VERSION AS base 57 58ARG BUILD_DATE=N/A 59ARG APP_VERSION=N/A 60ARG APP_REVISION=N/A 61ARG IMAGE_URL=https://github.com/ggml-org/llama.cpp 62ARG IMAGE_SOURCE=https://github.com/ggml-org/llama.cpp 63LABEL org.opencontainers.image.created=$ BUILD_DATE \ 64 org.opencontainers.image.version=$ APP_VERSION \ 65 org.opencontainers.image.revision=$ APP_REVISION \ 66 org.opencontainers.image.title="llama.cpp" \ 67 org.opencontainers.image.description="LLM inference in C/C++" \ 68 org.opencontainers.image.url=$ IMAGE_URL \ 69 org.opencontainers.image.source=$ IMAGE_SOURCE 70 71RUN apt-get update \ 72 && apt-get install -y libgomp1 curl ffmpeg \ 73 && apt autoremove -y \ 74 && apt clean -y \ 75 && rm -rf /tmp/* /var/tmp/* \ 76 && find /var/cache/apt/archives /var/lib/apt/lists -not -name lock -type f -delete \ 77 && find /var/cache -type f -delete 78 79COPY --from=build /app/lib/ /app 80 81### Full 82FROM baseAS full 83 84COPY --from=build /app/full /app 85 86WORKDIR /app 87 88RUN apt-get update \ 89 && apt-get install -y \ 90 git \ 91 python3 \ 92 python3-pip \ 93 python3-wheel \ 94 && pip install --break-system-packages --upgrade setuptools \ 95 && pip install --break-system-packages -r requirements.txt \ 96 && apt autoremove -y \ 97 && apt clean -y \ 98 && rm -rf /tmp/* /var/tmp/* \ 99 && find /var/cache/apt/archives /var/lib/apt/lists -not -name lock -type f -delete \ 100 && find /var/cache -type f -delete 101 102ENTRYPOINT ["/app/tools.sh" ] 103 104### Light, CLI only 105FROM baseAS light 106 107COPY --from=build /app/full/llama /app/full/llama-cli /app/full/llama-completion /app 108 109WORKDIR /app 110 111ENTRYPOINT ["/app/llama-cli" ] 112 113### Server, Server only 114FROM baseAS server 115 116ENV LLAMA_ARG_HOST=0.0.0.0 117 118COPY --from=build /app/full/llama /app/full/llama-server /app 119 120WORKDIR /app 121 122HEALTHCHECK CMD ["curl" ,"-f" ,"http://localhost:8080/health" ] 123 124ENTRYPOINT ["/app/llama-server" ]