Team Ai
Apppublic

KBaba7/llama.cpp

sourceHugging Faceapache-2.0updated 2y agoView on Hugging Face
0likes
musa.Dockerfile109 linesDownload Raw Back to .devops
1ARG UBUNTU_VERSION=22.042# This needs to generally match the container host's environment.3ARG MUSA_VERSION=rc3.1.04# Target the MUSA build image5ARG BASE_MUSA_DEV_CONTAINER=mthreads/musa:${MUSA_VERSION}-devel-ubuntu${UBUNTU_VERSION}6 7ARG BASE_MUSA_RUN_CONTAINER=mthreads/musa:${MUSA_VERSION}-runtime-ubuntu${UBUNTU_VERSION}8 9FROM ${BASE_MUSA_DEV_CONTAINER} AS build10 11# MUSA architecture to build for (defaults to all supported archs)12ARG MUSA_DOCKER_ARCH=default13 14RUN apt-get update && \15    apt-get install -y \16    build-essential \17    cmake \18    python3 \19    python3-pip \20    git \21    libcurl4-openssl-dev \22    libgomp123 24COPY requirements.txt   requirements.txt25COPY requirements       requirements26 27RUN pip install --upgrade pip setuptools wheel \28    && pip install -r requirements.txt29 30WORKDIR /app31 32COPY . .33 34# Use the default MUSA archs if not specified35RUN if [ "${MUSA_DOCKER_ARCH}" != "default" ]; then \36        export CMAKE_ARGS="-DMUSA_ARCHITECTURES=${MUSA_DOCKER_ARCH}"; \37    fi && \38    cmake -B build -DGGML_NATIVE=OFF -DGGML_MUSA=ON -DLLAMA_CURL=ON ${CMAKE_ARGS} -DCMAKE_EXE_LINKER_FLAGS=-Wl,--allow-shlib-undefined . && \39    cmake --build build --config Release -j$(nproc)40 41RUN mkdir -p /app/lib && \42    find build -name "*.so" -exec cp {} /app/lib \;43 44RUN mkdir -p /app/full \45    && cp build/bin/* /app/full \46    && cp *.py /app/full \47    && cp -r gguf-py /app/full \48    && cp -r requirements /app/full \49    && cp requirements.txt /app/full \50    && cp .devops/tools.sh /app/full/tools.sh51 52## Base image53FROM ${BASE_MUSA_RUN_CONTAINER} AS base54 55RUN apt-get update \56    && apt-get install -y libgomp1 curl\57    && apt autoremove -y \58    && apt clean -y \59    && rm -rf /tmp/* /var/tmp/* \60    && find /var/cache/apt/archives /var/lib/apt/lists -not -name lock -type f -delete \61    && find /var/cache -type f -delete62 63COPY --from=build /app/lib/ /app64 65### Full66FROM base AS full67 68COPY --from=build /app/full /app69 70WORKDIR /app71 72RUN apt-get update \73    && apt-get install -y \74    git \75    python3 \76    python3-pip \77    && pip install --upgrade pip setuptools wheel \78    && pip install -r requirements.txt \79    && apt autoremove -y \80    && apt clean -y \81    && rm -rf /tmp/* /var/tmp/* \82    && find /var/cache/apt/archives /var/lib/apt/lists -not -name lock -type f -delete \83    && find /var/cache -type f -delete84 85 86ENTRYPOINT ["/app/tools.sh"]87 88### Light, CLI only89FROM base AS light90 91COPY --from=build /app/full/llama-cli /app92 93WORKDIR /app94 95ENTRYPOINT [ "/app/llama-cli" ]96 97### Server, Server only98FROM base AS server99 100ENV LLAMA_ARG_HOST=0.0.0.0101 102COPY --from=build /app/full/llama-server /app103 104WORKDIR /app105 106HEALTHCHECK CMD [ "curl", "-f", "http://localhost:8080/health" ]107 108ENTRYPOINT [ "/app/llama-server" ]109