llama-cli-musa.Dockerfile 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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. # MUSA architecture to build for (defaults to all supported archs)
  10. ARG MUSA_DOCKER_ARCH=default
  11. RUN apt-get update && \
  12. apt-get install -y build-essential git cmake
  13. WORKDIR /app
  14. COPY . .
  15. # Use the default MUSA archs if not specified
  16. RUN if [ "${MUSA_DOCKER_ARCH}" != "default" ]; then \
  17. export CMAKE_ARGS="-DMUSA_ARCHITECTURES=${MUSA_DOCKER_ARCH}"; \
  18. fi && \
  19. cmake -B build -DGGML_NATIVE=OFF -DGGML_MUSA=ON ${CMAKE_ARGS} -DCMAKE_EXE_LINKER_FLAGS=-Wl,--allow-shlib-undefined . && \
  20. cmake --build build --config Release --target llama-cli -j$(nproc) && \
  21. mkdir -p /app/lib && \
  22. find build -name "*.so" -exec cp {} /app/lib \;
  23. FROM ${BASE_MUSA_RUN_CONTAINER} AS runtime
  24. RUN apt-get update && \
  25. apt-get install -y libgomp1
  26. COPY --from=build /app/lib/ /
  27. COPY --from=build /app/build/bin/llama-cli /llama-cli
  28. ENTRYPOINT [ "/llama-cli" ]