Spaces:
Build error
Build error
| # 1. Start from a standard Python 3.10 image | |
| FROM python:3.10-slim | |
| # 2. Set env to non-interactive to prevent build hangs | |
| ENV DEBIAN_FRONTEND=noninteractive | |
| # 3. Install build tools for llama-cpp-python | |
| # This fixes the "Failed building wheel" error. | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| build-essential \ | |
| cmake \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # 4. Set up work directory | |
| WORKDIR /code | |
| # 5. Copy *only* requirements and install | |
| # This caches the install layer, speeding up future builds | |
| COPY ./requirements.txt /code/requirements.txt | |
| RUN pip install --no-cache-dir --upgrade pip | |
| RUN pip install --no-cache-dir -r /code/requirements.txt | |
| # 6. Copy the rest of the app code | |
| COPY ./app.py /code/app.py | |
| # 7. Expose the port | |
| EXPOSE 7860 | |
| # 8. Run the app | |
| # The app.py script will now handle the model download on startup. | |
| CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] |