llama-server-musa.Dockerfile 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  1. ARG UBUNTU_VERSION=22.04
  2. # This needs to generally match the container host's environment.
  3. ARG MUSA_VERSION=rc3.1.0
  4. # Target the MUSA build image
  5. ARG BASE_MUSA_DEV_CONTAINER=mthreads/musa:${MUSA_VERSION}-devel-ubuntu${UBUNTU_VERSION}
  6. # Target the MUSA runtime image
  7. ARG BASE_MUSA_RUN_CONTAINER=mthreads/musa:${MUSA_VERSION}-runtime-ubuntu${UBUNTU_VERSION}
  8. FROM ${BASE_MUSA_DEV_CONTAINER} AS build
  9. RUN apt-get update && \
  10. apt-get install -y build-essential git cmake libcurl4-openssl-dev
  11. WORKDIR /app
  12. COPY . .
  13. RUN cmake -B build -DGGML_MUSA=ON -DLLAMA_CURL=ON ${CMAKE_ARGS} -DCMAKE_EXE_LINKER_FLAGS=-Wl,--allow-shlib-undefined . && \
  14. cmake --build build --config Release --target llama-server -j$(nproc) && \
  15. mkdir -p /app/lib && \
  16. find build -name "*.so" -exec cp {} /app/lib \;
  17. FROM ${BASE_MUSA_RUN_CONTAINER} AS runtime
  18. RUN apt-get update && \
  19. apt-get install -y libcurl4-openssl-dev libgomp1 curl
  20. COPY --from=build /app/lib/ /
  21. COPY --from=build /app/build/bin/llama-server /llama-server
  22. # Must be set to 0.0.0.0 so it can listen to requests from host machine
  23. ENV LLAMA_ARG_HOST=0.0.0.0
  24. HEALTHCHECK CMD [ "curl", "-f", "http://localhost:8080/health" ]
  25. ENTRYPOINT [ "/llama-server" ]