Spaces:
Sleeping
Sleeping
| FROM ubuntu:22.04 | |
| # Avoid interactive prompts during install | |
| ENV DEBIAN_FRONTEND=noninteractive | |
| # Install required packages | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| curl \ | |
| ca-certificates \ | |
| bash \ | |
| sudo \ | |
| git \ | |
| build-essential \ | |
| cmake \ | |
| build-essential \ | |
| ninja-build \ | |
| && rm -rf /var/lib/apt/lists/* | |
| ENV CMAKE_GENERATOR=Ninja | |
| ENV CMAKE_BUILD_PARALLEL_LEVEL=4 | |
| # Create non-root user with UID 1000 | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| WORKDIR /home/user | |
| # Install uv CLI as non-root user | |
| RUN curl -fsSL https://astral.sh/uv/install.sh -o uv-installer.sh && \ | |
| sh uv-installer.sh && \ | |
| rm uv-installer.sh | |
| ENV PATH="/home/user/.local/bin:$PATH" | |
| # Copy app source code with user ownership | |
| COPY --chown=user:user . /home/user/app | |
| WORKDIR /home/user/app | |
| # Synchronize uv environment | |
| RUN uv sync | |
| # Add llama-cpp-python from custom index URL | |
| # RUN uv add llama-cpp-python --extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cpu | |
| RUN uv pip install llama-cpp-python --no-binary llama-cpp-python --verbose | |
| # Optional: list files for verification | |
| # RUN ls -l /home/user/.venv/lib/python3.11/site-packages/llama_cpp/lib | |
| CMD ["uv", "run", "app.py"] | |