Spaces:
Sleeping
Sleeping
FROM python:3.12-slim | |
# Install system dependencies | |
RUN apt-get update && apt-get install -y \ | |
gcc g++ cmake build-essential curl git \ | |
&& apt-get clean && rm -rf /var/lib/apt/lists/* | |
# Set environment variables | |
ENV PYTHONUNBUFFERED=1 \ | |
PYTHON_VERSION=3.12.4 \ | |
HF_HOME=/data/.cache/huggingface \ | |
PATH="/root/.local/bin:$PATH" | |
# Set working directory | |
WORKDIR /app | |
# Ensure Hugging Face cache is writable | |
RUN mkdir -p /data/.cache/huggingface && \ | |
chmod -R 777 /data | |
# Copy requirements and install them | |
COPY requirements.txt . | |
RUN pip install --no-cache-dir --upgrade pip && \ | |
pip install llama-cpp-python==0.2.72 && \ | |
pip install --no-cache-dir -r requirements.txt | |
# Copy the rest of the application | |
COPY . . | |
# Expose FastAPI port | |
EXPOSE 7860 | |
# Run FastAPI app using uvicorn | |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] | |