# Use an official Python runtime as the base image FROM python:3.10-slim # Set the working directory WORKDIR /app # Install system dependencies (if needed for your model, e.g., libssl, gcc, etc.) RUN apt-get update && apt-get install -y \ build-essential \ curl \ libssl-dev \ && rm -rf /var/lib/apt/lists/* # Copy the current directory content into the container at /app COPY . /app # Install Python dependencies RUN pip install --no-cache-dir -r requirements.txt # Set the environment variable for Hugging Face cache ENV TRANSFORMERS_CACHE=/app/.cache # Make sure the cache directory exists and has the right permissions RUN mkdir -p /app/.cache && chmod -R 777 /app/.cache # Expose the FastAPI app port EXPOSE 7860 # Define the command to run your application CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]