| # Use an official Python runtime as a parent image | |
| FROM python:3.10-slim | |
| # Install system dependencies for building Python packages | |
| RUN apt-get update && \ | |
| apt-get install -y --no-install-recommends \ | |
| build-essential \ | |
| cmake \ | |
| git \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Set the working directory in the container | |
| WORKDIR /app | |
| # Copy the current directory contents into the container at /app | |
| COPY . /app | |
| # Install any needed packages specified in requirements.txt | |
| RUN pip install fastapi uvicorn llama-cpp-python pydantic | |
| # Download the model using Hugging Face CLI | |
| RUN pip install huggingface_hub \ | |
| && huggingface-cli download legraphista/Qwen2-1.5B-Instruct-IMat-GGUF Qwen2-1.5B-Instruct.IQ3_M.gguf --local-dir . --local-dir-use-symlinks False | |
| # Make port 8000 available to the world outside this container | |
| EXPOSE 8000 | |
| # Run the server | |
| CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] | |