# Use Python as the base image FROM python:3.9 # Set environment variables for cache ENV HF_HOME=/tmp/hf_home # Set the working directory WORKDIR /app # Copy requirements and install dependencies COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copy the FastAPI app COPY . . # Ensure the cache directory is created and has proper permissions RUN mkdir -p /tmp/hf_home && chmod -R 777 /tmp/hf_home # Run FastAPI server CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]