CoolFace
Modelpublic

Felipe97/llama-cpp-compiled

sourceHugging Faceupdated 2d agoView on Hugging Face
0likes1.1kdownloads
cpu.Dockerfile125 linesDownload Raw Back to .devops
1ARG UBUNTU_VERSION=24.042ARG BUILD_DATE=N/A3ARG APP_VERSION=N/A4ARG APP_REVISION=N/A5 6ARG NODE_VERSION=247 8FROM docker.io/node:$NODE_VERSION AS web9 10ARG APP_VERSION11 12WORKDIR /app/tools/ui13 14COPY tools/ui/package.json tools/ui/package-lock.json ./15RUN npm ci16 17COPY tools/ui/ ./18RUN LLAMA_BUILD_NUMBER="$APP_VERSION" npm run build19 20FROM docker.io/ubuntu:$UBUNTU_VERSION AS build21 22ARG TARGETARCH23 24RUN apt-get update && \25    apt-get install -y gcc-14 g++-14 build-essential git cmake libssl-dev26 27ENV CC=gcc-14 CXX=g++-1428 29WORKDIR /app30 31COPY . .32 33COPY --from=web /app/tools/ui/dist tools/ui/dist34 35RUN if [ "$TARGETARCH" = "amd64" ] || [ "$TARGETARCH" = "arm64" ]; then \36        cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DGGML_NATIVE=OFF -DLLAMA_BUILD_TESTS=OFF -DGGML_BACKEND_DL=ON -DGGML_CPU_ALL_VARIANTS=ON; \37    else \38        echo "Unsupported architecture"; \39        exit 1; \40    fi && \41    cmake --build build -j $(nproc)42 43RUN mkdir -p /app/lib && \44    find build -name "*.so*" -exec cp -P {} /app/lib \;45 46RUN mkdir -p /app/full \47    && cp build/bin/* /app/full \48    && cp *.py /app/full \49    && cp -r conversion /app/full \50    && cp -r gguf-py /app/full \51    && cp -r requirements /app/full \52    && cp requirements.txt /app/full \53    && cp .devops/tools.sh /app/full/tools.sh54 55## Base image56FROM docker.io/ubuntu:$UBUNTU_VERSION AS base57 58ARG BUILD_DATE=N/A59ARG APP_VERSION=N/A60ARG APP_REVISION=N/A61ARG IMAGE_URL=https://github.com/ggml-org/llama.cpp62ARG IMAGE_SOURCE=https://github.com/ggml-org/llama.cpp63LABEL org.opencontainers.image.created=$BUILD_DATE \64      org.opencontainers.image.version=$APP_VERSION \65      org.opencontainers.image.revision=$APP_REVISION \66      org.opencontainers.image.title="llama.cpp" \67      org.opencontainers.image.description="LLM inference in C/C++" \68      org.opencontainers.image.url=$IMAGE_URL \69      org.opencontainers.image.source=$IMAGE_SOURCE70 71RUN apt-get update \72    && apt-get install -y libgomp1 curl ffmpeg \73    && apt autoremove -y \74    && apt clean -y \75    && rm -rf /tmp/* /var/tmp/* \76    && find /var/cache/apt/archives /var/lib/apt/lists -not -name lock -type f -delete \77    && find /var/cache -type f -delete78 79COPY --from=build /app/lib/ /app80 81### Full82FROM base AS full83 84COPY --from=build /app/full /app85 86WORKDIR /app87 88RUN apt-get update \89    && apt-get install -y \90    git \91    python3 \92    python3-pip \93    python3-wheel \94    && pip install --break-system-packages --upgrade setuptools \95    && pip install --break-system-packages -r requirements.txt \96    && apt autoremove -y \97    && apt clean -y \98    && rm -rf /tmp/* /var/tmp/* \99    && find /var/cache/apt/archives /var/lib/apt/lists -not -name lock -type f -delete \100    && find /var/cache -type f -delete101 102ENTRYPOINT ["/app/tools.sh"]103 104### Light, CLI only105FROM base AS light106 107COPY --from=build /app/full/llama /app/full/llama-cli /app/full/llama-completion /app108 109WORKDIR /app110 111ENTRYPOINT [ "/app/llama-cli" ]112 113### Server, Server only114FROM base AS server115 116ENV LLAMA_ARG_HOST=0.0.0.0117 118COPY --from=build /app/full/llama /app/full/llama-server /app119 120WORKDIR /app121 122HEALTHCHECK CMD [ "curl", "-f", "http://localhost:8080/health" ]123 124ENTRYPOINT [ "/app/llama-server" ]125