KBaba7/llama.cpp
0
1ARG ONEAPI_VERSION=2025.0.0-0-devel-ubuntu22.042 3## Build Image4 5FROM intel/oneapi-basekit:$ONEAPI_VERSION AS build6 7ARG GGML_SYCL_F16=OFF8RUN apt-get update && \9 apt-get install -y git libcurl4-openssl-dev10 11WORKDIR /app12 13COPY . .14 15RUN if [ "${GGML_SYCL_F16}" = "ON" ]; then \16 echo "GGML_SYCL_F16 is set" \17 && export OPT_SYCL_F16="-DGGML_SYCL_F16=ON"; \18 fi && \19 echo "Building with dynamic libs" && \20 cmake -B build -DGGML_NATIVE=OFF -DGGML_SYCL=ON -DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icpx -DLLAMA_CURL=ON ${OPT_SYCL_F16} && \21 cmake --build build --config Release -j$(nproc)22 23RUN mkdir -p /app/lib && \24 find build -name "*.so" -exec cp {} /app/lib \;25 26RUN mkdir -p /app/full \27 && cp build/bin/* /app/full \28 && cp *.py /app/full \29 && cp -r gguf-py /app/full \30 && cp -r requirements /app/full \31 && cp requirements.txt /app/full \32 && cp .devops/tools.sh /app/full/tools.sh33 34FROM intel/oneapi-basekit:$ONEAPI_VERSION AS base35 36RUN apt-get update \37 && apt-get install -y libgomp1 curl\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 44### Full45FROM base AS full46 47COPY --from=build /app/lib/ /app48COPY --from=build /app/full /app49 50WORKDIR /app51 52RUN apt-get update \53 && apt-get install -y \54 git \55 python3 \56 python3-pip \57 && pip install --upgrade pip setuptools wheel \58 && pip install -r requirements.txt \59 && apt autoremove -y \60 && apt clean -y \61 && rm -rf /tmp/* /var/tmp/* \62 && find /var/cache/apt/archives /var/lib/apt/lists -not -name lock -type f -delete \63 && find /var/cache -type f -delete64 65 66ENTRYPOINT ["/app/tools.sh"]67 68### Light, CLI only69FROM base AS light70 71COPY --from=build /app/lib/ /app72COPY --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/lib/ /app84COPY --from=build /app/full/llama-server /app85 86WORKDIR /app87 88HEALTHCHECK CMD [ "curl", "-f", "http://localhost:8080/health" ]89 90ENTRYPOINT [ "/app/llama-server" ]91 92 