CoolFace
Modelpublic

Felipe97/llama-cpp-compiled

sourceHugging Faceupdated 3d agoView on Hugging Face
0likes1.1kdownloads
cuda.Dockerfile134 linesDownload Raw Back to .devops
1ARG UBUNTU_VERSION=24.042# This needs to generally match the container host's environment.3ARG CUDA_VERSION=12.8.14ARG GCC_VERSION=145# Target the CUDA build image6ARG BASE_CUDA_DEV_CONTAINER=docker.io/nvidia/cuda:${CUDA_VERSION}-devel-ubuntu${UBUNTU_VERSION}7 8ARG BASE_CUDA_RUN_CONTAINER=docker.io/nvidia/cuda:${CUDA_VERSION}-runtime-ubuntu${UBUNTU_VERSION}9 10ARG BUILD_DATE=N/A11ARG APP_VERSION=N/A12ARG APP_REVISION=N/A13 14ARG NODE_VERSION=2415 16FROM docker.io/node:$NODE_VERSION AS web17 18ARG APP_VERSION19 20WORKDIR /app/tools/ui21 22COPY tools/ui/package.json tools/ui/package-lock.json ./23RUN npm ci24 25COPY tools/ui/ ./26RUN LLAMA_BUILD_NUMBER="$APP_VERSION" npm run build27 28FROM ${BASE_CUDA_DEV_CONTAINER} AS build29 30ARG GCC_VERSION31# CUDA architecture to build for (defaults to all supported archs)32ARG CUDA_DOCKER_ARCH=default33 34RUN apt-get update && \35    apt-get install -y gcc-${GCC_VERSION} g++-${GCC_VERSION} build-essential cmake python3 python3-pip git libssl-dev libgomp136 37ENV CC=gcc-${GCC_VERSION} CXX=g++-${GCC_VERSION} CUDAHOSTCXX=g++-${GCC_VERSION}38 39WORKDIR /app40 41COPY . .42 43COPY --from=web /app/tools/ui/dist tools/ui/dist44 45RUN if [ "${CUDA_DOCKER_ARCH}" != "default" ]; then \46    export CMAKE_ARGS="-DCMAKE_CUDA_ARCHITECTURES=${CUDA_DOCKER_ARCH}"; \47    fi && \48    cmake -B build -DGGML_NATIVE=OFF -DGGML_CUDA=ON -DGGML_BACKEND_DL=ON -DGGML_CPU_ALL_VARIANTS=ON -DLLAMA_BUILD_TESTS=OFF ${CMAKE_ARGS} -DCMAKE_EXE_LINKER_FLAGS=-Wl,--allow-shlib-undefined . && \49    cmake --build build --config Release -j$(nproc)50 51RUN mkdir -p /app/lib && \52    find build -name "*.so*" -exec cp -P {} /app/lib \;53 54RUN mkdir -p /app/full \55    && cp build/bin/* /app/full \56    && cp *.py /app/full \57    && cp -r conversion /app/full \58    && cp -r gguf-py /app/full \59    && cp -r requirements /app/full \60    && cp requirements.txt /app/full \61    && cp .devops/tools.sh /app/full/tools.sh62 63## Base image64FROM ${BASE_CUDA_RUN_CONTAINER} AS base65 66ARG BUILD_DATE=N/A67ARG APP_VERSION=N/A68ARG APP_REVISION=N/A69ARG IMAGE_URL=https://github.com/ggml-org/llama.cpp70ARG IMAGE_SOURCE=https://github.com/ggml-org/llama.cpp71LABEL org.opencontainers.image.created=$BUILD_DATE \72      org.opencontainers.image.version=$APP_VERSION \73      org.opencontainers.image.revision=$APP_REVISION \74      org.opencontainers.image.title="llama.cpp" \75      org.opencontainers.image.description="LLM inference in C/C++" \76      org.opencontainers.image.url=$IMAGE_URL \77      org.opencontainers.image.source=$IMAGE_SOURCE78 79RUN apt-get update \80    && apt-get install -y libgomp1 curl ffmpeg \81    && apt autoremove -y \82    && apt clean -y \83    && rm -rf /tmp/* /var/tmp/* \84    && find /var/cache/apt/archives /var/lib/apt/lists -not -name lock -type f -delete \85    && find /var/cache -type f -delete86 87COPY --from=build /app/lib/ /app88 89### Full90FROM base AS full91 92COPY --from=build /app/full /app93 94WORKDIR /app95 96RUN apt-get update \97    && apt-get install -y \98    git \99    python3 \100    python3-pip \101    python3-wheel \102    && pip install --break-system-packages --upgrade setuptools \103    && pip install --break-system-packages -r requirements.txt \104    && apt autoremove -y \105    && apt clean -y \106    && rm -rf /tmp/* /var/tmp/* \107    && find /var/cache/apt/archives /var/lib/apt/lists -not -name lock -type f -delete \108    && find /var/cache -type f -delete109 110 111ENTRYPOINT ["/app/tools.sh"]112 113### Light, CLI only114FROM base AS light115 116COPY --from=build /app/full/llama /app/full/llama-cli /app/full/llama-completion /app117 118WORKDIR /app119 120ENTRYPOINT [ "/app/llama-cli" ]121 122### Server, Server only123FROM base AS server124 125ENV LLAMA_ARG_HOST=0.0.0.0126 127COPY --from=build /app/full/llama /app/full/llama-server /app128 129WORKDIR /app130 131HEALTHCHECK CMD [ "curl", "-f", "http://localhost:8080/health" ]132 133ENTRYPOINT [ "/app/llama-server" ]134