# Use an official lightweight Python image FROM python:3.10-slim # Set environment variables to prevent Python from writing .pyc files and buffering stdout/stderr ENV PYTHONDONTWRITEBYTECODE=1 ENV PYTHONUNBUFFERED=1 RUN mkdir -p /app/hf_cache # Set working directory WORKDIR /app # Copy and install dependencies COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copy the entire application COPY . . RUN chmod 777 /app/faqs.csv # Expose the port FastAPI will run on (Hugging Face requires 7860) EXPOSE 7860 # Run the FastAPI app using uvicorn CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]