# Use the official Python image as the base FROM python:3.9-slim # Set the working directory inside the container WORKDIR /app # Set environment variables for cache ENV HF_HOME=/tmp/hf_cache ENV HUGGINGFACE_HUB_CACHE=/tmp/hf_cache ENV TRANSFORMERS_CACHE=/tmp/hf_cache # Copy all project files to the container COPY . /app # Install the required Python packages RUN pip install --no-cache-dir -r requirements.txt # Create the cache directory and set permissions RUN mkdir -p /tmp/hf_cache && chmod -R 777 /tmp/hf_cache # Expose the port that FastAPI will run on EXPOSE 7860 # Command to run the FastAPI application CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]