intel.Dockerfile 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. ARG ONEAPI_VERSION=2025.0.0-0-devel-ubuntu22.04
  2. ## Build Image
  3. FROM intel/oneapi-basekit:$ONEAPI_VERSION AS build
  4. ARG GGML_SYCL_F16=OFF
  5. RUN apt-get update && \
  6. apt-get install -y git libcurl4-openssl-dev
  7. WORKDIR /app
  8. COPY . .
  9. RUN if [ "${GGML_SYCL_F16}" = "ON" ]; then \
  10. echo "GGML_SYCL_F16 is set" \
  11. && export OPT_SYCL_F16="-DGGML_SYCL_F16=ON"; \
  12. fi && \
  13. echo "Building with dynamic libs" && \
  14. cmake -B build -DGGML_NATIVE=OFF -DGGML_SYCL=ON -DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icpx -DGGML_BACKEND_DL=ON -DGGML_CPU_ALL_VARIANTS=ON -DLLAMA_BUILD_TESTS=OFF ${OPT_SYCL_F16} && \
  15. cmake --build build --config Release -j$(nproc)
  16. RUN mkdir -p /app/lib && \
  17. find build -name "*.so" -exec cp {} /app/lib \;
  18. RUN mkdir -p /app/full \
  19. && cp build/bin/* /app/full \
  20. && cp *.py /app/full \
  21. && cp -r gguf-py /app/full \
  22. && cp -r requirements /app/full \
  23. && cp requirements.txt /app/full \
  24. && cp .devops/tools.sh /app/full/tools.sh
  25. FROM intel/oneapi-basekit:$ONEAPI_VERSION AS base
  26. RUN apt-get update \
  27. && apt-get install -y libgomp1 curl\
  28. && apt autoremove -y \
  29. && apt clean -y \
  30. && rm -rf /tmp/* /var/tmp/* \
  31. && find /var/cache/apt/archives /var/lib/apt/lists -not -name lock -type f -delete \
  32. && find /var/cache -type f -delete
  33. ### Full
  34. FROM base AS full
  35. COPY --from=build /app/lib/ /app
  36. COPY --from=build /app/full /app
  37. WORKDIR /app
  38. RUN apt-get update \
  39. && apt-get install -y \
  40. git \
  41. python3 \
  42. python3-pip \
  43. && pip install --upgrade pip setuptools wheel \
  44. && pip install -r requirements.txt \
  45. && apt autoremove -y \
  46. && apt clean -y \
  47. && rm -rf /tmp/* /var/tmp/* \
  48. && find /var/cache/apt/archives /var/lib/apt/lists -not -name lock -type f -delete \
  49. && find /var/cache -type f -delete
  50. ENTRYPOINT ["/app/tools.sh"]
  51. ### Light, CLI only
  52. FROM base AS light
  53. COPY --from=build /app/lib/ /app
  54. COPY --from=build /app/full/llama-cli /app
  55. WORKDIR /app
  56. ENTRYPOINT [ "/app/llama-cli" ]
  57. ### Server, Server only
  58. FROM base AS server
  59. ENV LLAMA_ARG_HOST=0.0.0.0
  60. COPY --from=build /app/lib/ /app
  61. COPY --from=build /app/full/llama-server /app
  62. WORKDIR /app
  63. HEALTHCHECK CMD [ "curl", "-f", "http://localhost:8080/health" ]
  64. ENTRYPOINT [ "/app/llama-server" ]