Spaces:
Sleeping
Sleeping
Dmitry Beresnev commited on
Commit ·
7f69342
1
Parent(s): cba98c9
fix dockerfile
Browse files12345678910111213141516171819202122232425262728293031323334353637383940FROM python:3.12-slim# Install build dependencies for llama-cpp-pythonRUN apt-get update && apt-get install -y --no-install-recommends \gcc \g++ \cmake \&& rm -rf /var/lib/apt/lists/*RUN pip install --no-cache-dir --root-user-action=ignore uvWORKDIR /appCOPY pyproject.toml /app/pyproject.toml# Install dependencies (llama-cpp-python will compile but with minimal features)#ENV CMAKE_ARGS="-DLLAMA_BLAS=OFF -DLLAMA_AVX2=OFF -DLLAMA_FMA=OFF -DLLAMA_F16C=OFF"RUN uv pip install --system -r pyproject.tomlCOPY . /app# RUN uv pip install --system --no-cache .# Create a non-root user# explicitly create the HF_HOME directory and give the user ownership# so they can save the downloaded model there.RUN useradd -m -u 1000 user && \mkdir -p /home/user/.cache/huggingface && \chown -R user:user /home/userUSER userENV HOME=/home/user \PATH=/home/user/.local/bin:$PATH \HF_HOME=/home/user/.cache/huggingfaceEXPOSE 7860# Start the applicationCMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152FROM debian:bookworm-slim AS builder# Install build dependenciesRUN apt-get update && apt-get install -y --no-install-recommends \git \build-essential \cmake \ca-certificates \&& rm -rf /var/lib/apt/lists/*# Clone and build llama.cppWORKDIR /buildRUN git clone https://github.com/ggerganov/llama.cpp.git && \cd llama.cpp && \cmake -B build -DCMAKE_BUILD_TYPE=Release -DGGML_NATIVE=OFF -DGGML_AVX2=OFF && \cmake --build build --config Release --target llama-server -j$(nproc)# Runtime stageFROM debian:bookworm-slim# Install runtime dependenciesRUN apt-get update && apt-get install -y --no-install-recommends \curl \ca-certificates \&& rm -rf /var/lib/apt/lists/*# Copy llama-server binary from builderCOPY --from=builder /build/llama.cpp/build/bin/llama-server /usr/local/bin/llama-server# Create non-root userRUN useradd -m -u 1000 user && \mkdir -p /home/user/.cache/llama.cpp && \chown -R user:user /home/userUSER userWORKDIR /home/user# Set environment variablesENV HOME=/home/user \LLAMA_CACHE=/home/user/.cache/llama.cpp \PATH=/home/user/.local/bin:$PATHEXPOSE 7860# Start llama-server with HuggingFace model# Using TheBloke's DeepSeek Coder GGUF modelCMD ["llama-server", \"-hf", "TheBloke/deepseek-coder-6.7B-instruct-GGUF:deepseek-coder-6.7b-instruct.Q4_K_M.gguf", \"--host", "0.0.0.0", \"--port", "7860", \"-c", "2048", \"--metrics"]
Dockerfile+34-22