vulkan.Dockerfile 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. ARG UBUNTU_VERSION=26.04
  2. FROM ubuntu:$UBUNTU_VERSION AS build
  3. # Install build tools
  4. RUN apt update && apt install -y git build-essential cmake wget xz-utils
  5. # Install cURL and Vulkan SDK dependencies
  6. RUN apt install -y libcurl4-openssl-dev curl \
  7. libxcb-xinput0 libxcb-xinerama0 libxcb-cursor-dev libvulkan-dev glslc
  8. # Build it
  9. WORKDIR /app
  10. COPY . .
  11. RUN cmake -B build -DGGML_NATIVE=OFF -DGGML_VULKAN=ON -DLLAMA_BUILD_TESTS=OFF -DGGML_BACKEND_DL=ON -DGGML_CPU_ALL_VARIANTS=ON && \
  12. cmake --build build --config Release -j$(nproc)
  13. RUN mkdir -p /app/lib && \
  14. find build -name "*.so*" -exec cp -P {} /app/lib \;
  15. RUN mkdir -p /app/full \
  16. && cp build/bin/* /app/full \
  17. && cp *.py /app/full \
  18. && cp -r gguf-py /app/full \
  19. && cp -r requirements /app/full \
  20. && cp requirements.txt /app/full \
  21. && cp .devops/tools.sh /app/full/tools.sh
  22. ## Base image
  23. FROM ubuntu:$UBUNTU_VERSION AS base
  24. RUN apt-get update \
  25. && apt-get install -y libgomp1 curl libvulkan1 mesa-vulkan-drivers \
  26. && apt autoremove -y \
  27. && apt clean -y \
  28. && rm -rf /tmp/* /var/tmp/* \
  29. && find /var/cache/apt/archives /var/lib/apt/lists -not -name lock -type f -delete \
  30. && find /var/cache -type f -delete
  31. COPY --from=build /app/lib/ /app
  32. ### Full
  33. FROM base AS full
  34. COPY --from=build /app/full /app
  35. WORKDIR /app
  36. RUN apt-get update \
  37. && apt-get install -y \
  38. build-essential \
  39. git \
  40. python3 \
  41. python3-pip \
  42. python3-wheel \
  43. && pip install --break-system-packages --upgrade setuptools \
  44. && pip install --break-system-packages -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/full/llama-cli /app
  54. WORKDIR /app
  55. ENTRYPOINT [ "/app/llama-cli" ]
  56. ### Server, Server only
  57. FROM base AS server
  58. ENV LLAMA_ARG_HOST=0.0.0.0
  59. COPY --from=build /app/full/llama-server /app
  60. WORKDIR /app
  61. HEALTHCHECK CMD [ "curl", "-f", "http://localhost:8080/health" ]
  62. ENTRYPOINT [ "/app/llama-server" ]