Spaces:
Sleeping
Sleeping
| FROM docker.io/library/ubuntu:22.04 AS builder | |
| ENV DEBIAN_FRONTEND=noninteractive | |
| ENV TZ=UTC | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| build-essential cmake git libopenblas-dev curl ca-certificates \ | |
| && rm -rf /var/lib/apt/lists/* | |
| WORKDIR /app | |
| RUN git clone --depth 1 --branch master https://github.com/ggml-org/llama.cpp.git | |
| WORKDIR /app/llama.cpp | |
| RUN cmake -B build \ | |
| -DCMAKE_BUILD_TYPE=Release \ | |
| -DGGML_OPENBLAS=ON \ | |
| -DGGML_NATIVE=ON \ | |
| -DGGML_AVX2=ON \ | |
| -DGGML_F16C=ON \ | |
| -DGGML_LTO=ON \ | |
| -DLLAMA_BUILD_EXAMPLES=OFF \ | |
| -DLLAMA_BUILD_SERVER=ON \ | |
| -DLLAMA_BUILD_TESTS=OFF \ | |
| -DLLAMA_BUILD_CLI=OFF \ | |
| -DBUILD_SHARED_LIBS=OFF | |
| RUN cmake --build build --config Release -j 2 | |
| FROM docker.io/library/ubuntu:22.04 AS runner | |
| ENV DEBIAN_FRONTEND=noninteractive | |
| ENV TZ=UTC | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| curl ca-certificates libgomp1 libopenblas0 \ | |
| python3 python3-venv \ | |
| && rm -rf /var/lib/apt/lists/* | |
| RUN python3 -m venv /opt/venv && \ | |
| /opt/venv/bin/pip install --no-cache-dir huggingface-hub | |
| ENV PATH="/opt/venv/bin:$PATH" | |
| RUN mkdir -p /data/models | |
| COPY --from=builder /app/llama.cpp/build/bin/llama-server /usr/local/bin/llama-server | |
| COPY config.env /etc/config.env | |
| COPY entrypoint.sh /usr/local/bin/entrypoint.sh | |
| RUN chmod +x /usr/local/bin/entrypoint.sh | |
| EXPOSE 7860 | |
| ENTRYPOINT ["/usr/local/bin/entrypoint.sh"] |