# Use an official Python runtime as a parent image FROM python:3.8-slim # Set the working directory in the container WORKDIR /app # Install system dependencies RUN apt-get update && apt-get install -y \ libglib2.0-0 \ libsm6 \ libxrender1 \ libxext6 # Set environment variable for transformers cache ENV TRANSFORMERS_CACHE=/app/cache # Copy the current directory contents into the container at /app COPY . /app # Install any needed packages specified in requirements.txt RUN pip install --no-cache-dir -r requirements.txt # Expose port 8000 for the FastAPI app EXPOSE 8000 # Create cache directory RUN mkdir -p /app/cache && chmod -R 777 /app/cache # Run the FastAPI app with uvicorn CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000"]