1
0

intel.Dockerfile 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. ARG ONEAPI_VERSION=2025.1.1-0-devel-ubuntu24.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. python3-venv && \
  44. python3 -m venv /opt/venv && \
  45. . /opt/venv/bin/activate && \
  46. pip install --upgrade pip setuptools wheel && \
  47. pip install -r requirements.txt && \
  48. apt autoremove -y && \
  49. apt clean -y && \
  50. rm -rf /tmp/* /var/tmp/* && \
  51. find /var/cache/apt/archives /var/lib/apt/lists -not -name lock -type f -delete && \
  52. find /var/cache -type f -delete
  53. ENV PATH="/opt/venv/bin:$PATH"
  54. ENTRYPOINT ["/app/tools.sh"]
  55. ### Light, CLI only
  56. FROM base AS light
  57. COPY --from=build /app/lib/ /app
  58. COPY --from=build /app/full/llama-cli /app
  59. WORKDIR /app
  60. ENTRYPOINT [ "/app/llama-cli" ]
  61. ### Server, Server only
  62. FROM base AS server
  63. ENV LLAMA_ARG_HOST=0.0.0.0
  64. COPY --from=build /app/lib/ /app
  65. COPY --from=build /app/full/llama-server /app
  66. WORKDIR /app
  67. HEALTHCHECK CMD [ "curl", "-f", "http://localhost:8080/health" ]
  68. ENTRYPOINT [ "/app/llama-server" ]