CoolFace
Modelpublic

Felipe97/llama-cpp-compiled

sourceHugging Faceupdated 3d agoView on Hugging Face
0likes1.1kdownloads
musa.Dockerfile136 linesDownload Raw Back to .devops
1ARG UBUNTU_VERSION=22.042# This needs to generally match the container host's environment.3ARG MUSA_VERSION=rc4.3.04# Target the MUSA build image5ARG BASE_MUSA_DEV_CONTAINER=docker.io/mthreads/musa:${MUSA_VERSION}-devel-ubuntu${UBUNTU_VERSION}-amd646 7ARG BASE_MUSA_RUN_CONTAINER=docker.io/mthreads/musa:${MUSA_VERSION}-runtime-ubuntu${UBUNTU_VERSION}-amd648 9ARG BUILD_DATE=N/A10ARG APP_VERSION=N/A11ARG APP_REVISION=N/A12 13ARG NODE_VERSION=2414 15FROM docker.io/node:$NODE_VERSION AS web16 17ARG APP_VERSION18 19WORKDIR /app/tools/ui20 21COPY tools/ui/package.json tools/ui/package-lock.json ./22RUN npm ci23 24COPY tools/ui/ ./25RUN LLAMA_BUILD_NUMBER="$APP_VERSION" npm run build26 27FROM ${BASE_MUSA_DEV_CONTAINER} AS build28 29# MUSA architecture to build for (defaults to all supported archs)30ARG MUSA_DOCKER_ARCH=default31 32RUN apt-get update && \33    apt-get install -y \34    build-essential \35    cmake \36    python3 \37    python3-pip \38    git \39    libssl-dev \40    libgomp141 42WORKDIR /app43 44COPY . .45 46COPY --from=web /app/tools/ui/dist tools/ui/dist47 48RUN if [ "${MUSA_DOCKER_ARCH}" != "default" ]; then \49        export CMAKE_ARGS="-DMUSA_ARCHITECTURES=${MUSA_DOCKER_ARCH}"; \50    fi && \51    cmake -B build -DGGML_NATIVE=OFF -DGGML_MUSA=ON -DGGML_BACKEND_DL=ON -DGGML_CPU_ALL_VARIANTS=ON -DLLAMA_BUILD_TESTS=OFF ${CMAKE_ARGS} -DCMAKE_EXE_LINKER_FLAGS=-Wl,--allow-shlib-undefined . && \52    cmake --build build --config Release -j$(nproc)53 54RUN mkdir -p /app/lib && \55    find build -name "*.so*" -exec cp -P {} /app/lib \;56 57RUN mkdir -p /app/full \58    && cp build/bin/* /app/full \59    && cp *.py /app/full \60    && cp -r conversion /app/full \61    && cp -r gguf-py /app/full \62    && cp -r requirements /app/full \63    && cp requirements.txt /app/full \64    && cp .devops/tools.sh /app/full/tools.sh65 66## Base image67FROM ${BASE_MUSA_RUN_CONTAINER} AS base68 69ARG BUILD_DATE=N/A70ARG APP_VERSION=N/A71ARG APP_REVISION=N/A72ARG IMAGE_URL=https://github.com/ggml-org/llama.cpp73ARG IMAGE_SOURCE=https://github.com/ggml-org/llama.cpp74LABEL org.opencontainers.image.created=$BUILD_DATE \75      org.opencontainers.image.version=$APP_VERSION \76      org.opencontainers.image.revision=$APP_REVISION \77      org.opencontainers.image.title="llama.cpp" \78      org.opencontainers.image.description="LLM inference in C/C++" \79      org.opencontainers.image.url=$IMAGE_URL \80      org.opencontainers.image.source=$IMAGE_SOURCE81 82RUN apt-get update \83    && apt-get install -y libgomp1 curl ffmpeg \84    && apt autoremove -y \85    && apt clean -y \86    && rm -rf /tmp/* /var/tmp/* \87    && find /var/cache/apt/archives /var/lib/apt/lists -not -name lock -type f -delete \88    && find /var/cache -type f -delete89 90COPY --from=build /app/lib/ /app91 92### Full93FROM base AS full94 95COPY --from=build /app/full /app96 97WORKDIR /app98 99RUN apt-get update \100    && apt-get install -y \101    git \102    python3 \103    python3-pip \104    && pip install --upgrade pip setuptools wheel \105    && pip install -r requirements.txt \106    && apt autoremove -y \107    && apt clean -y \108    && rm -rf /tmp/* /var/tmp/* \109    && find /var/cache/apt/archives /var/lib/apt/lists -not -name lock -type f -delete \110    && find /var/cache -type f -delete111 112 113ENTRYPOINT ["/app/tools.sh"]114 115### Light, CLI only116FROM base AS light117 118COPY --from=build /app/full/llama /app/full/llama-cli /app/full/llama-completion /app119 120WORKDIR /app121 122ENTRYPOINT [ "/app/llama-cli" ]123 124### Server, Server only125FROM base AS server126 127ENV LLAMA_ARG_HOST=0.0.0.0128 129COPY --from=build /app/full/llama /app/full/llama-server /app130 131WORKDIR /app132 133HEALTHCHECK CMD [ "curl", "-f", "http://localhost:8080/health" ]134 135ENTRYPOINT [ "/app/llama-server" ]136