KBaba7/llama.cpp
0
1ARG UBUNTU_VERSION=24.042 3FROM ubuntu:$UBUNTU_VERSION AS build4 5# Install build tools6RUN apt update && apt install -y git build-essential cmake wget7 8# Install Vulkan SDK and cURL9RUN wget -qO - https://packages.lunarg.com/lunarg-signing-key-pub.asc | apt-key add - && \10 wget -qO /etc/apt/sources.list.d/lunarg-vulkan-noble.list https://packages.lunarg.com/vulkan/lunarg-vulkan-noble.list && \11 apt update -y && \12 apt-get install -y vulkan-sdk libcurl4-openssl-dev curl13 14# Build it15WORKDIR /app16 17COPY . .18 19RUN cmake -B build -DGGML_NATIVE=OFF -DGGML_VULKAN=1 -DLLAMA_CURL=1 && \20 cmake --build build --config Release -j$(nproc)21 22RUN mkdir -p /app/lib && \23 find build -name "*.so" -exec cp {} /app/lib \;24 25RUN mkdir -p /app/full \26 && cp build/bin/* /app/full \27 && cp *.py /app/full \28 && cp -r gguf-py /app/full \29 && cp -r requirements /app/full \30 && cp requirements.txt /app/full \31 && cp .devops/tools.sh /app/full/tools.sh32 33## Base image34FROM ubuntu:$UBUNTU_VERSION AS base35 36RUN apt-get update \37 && apt-get install -y libgomp1 curl libvulkan-dev \38 && apt autoremove -y \39 && apt clean -y \40 && rm -rf /tmp/* /var/tmp/* \41 && find /var/cache/apt/archives /var/lib/apt/lists -not -name lock -type f -delete \42 && find /var/cache -type f -delete43 44COPY --from=build /app/lib/ /app45 46### Full47FROM base AS full48 49COPY --from=build /app/full /app50 51WORKDIR /app52 53RUN apt-get update \54 && apt-get install -y \55 git \56 python3 \57 python3-pip \58 python3-wheel \59 && pip install --break-system-packages --upgrade setuptools \60 && pip install --break-system-packages -r requirements.txt \61 && apt autoremove -y \62 && apt clean -y \63 && rm -rf /tmp/* /var/tmp/* \64 && find /var/cache/apt/archives /var/lib/apt/lists -not -name lock -type f -delete \65 && find /var/cache -type f -delete66 67ENTRYPOINT ["/app/tools.sh"]68 69### Light, CLI only70FROM base AS light71 72COPY --from=build /app/full/llama-cli /app73 74WORKDIR /app75 76ENTRYPOINT [ "/app/llama-cli" ]77 78### Server, Server only79FROM base AS server80 81ENV LLAMA_ARG_HOST=0.0.0.082 83COPY --from=build /app/full/llama-server /app84 85WORKDIR /app86 87HEALTHCHECK CMD [ "curl", "-f", "http://localhost:8080/health" ]88 89ENTRYPOINT [ "/app/llama-server" ]90 