# 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 --mount=type=cache,target=/root/.cache/pip \ pip install -r requirements.txt # Copy the entire application COPY . . RUN chmod 666 /app/faqs.csv /app/question_limit_log.json # 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", "--proxy-headers"]