# Use a lightweight Python base image FROM python:3.9-slim # Set the working directory in the container WORKDIR /app # Copy all files from the current directory to the container COPY . . # Install Python dependencies, including PyTorch RUN pip install --no-cache-dir -r requirements.txt # Create a writable cache directory for Hugging Face models RUN mkdir -p /app/.cache && chmod -R 777 /app/.cache # Set an environment variable for the cache directory ENV TRANSFORMERS_CACHE=/app/.cache # Expose the port your app will run on EXPOSE 7860 # Run the FastAPI app with Uvicorn CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]