# Use a Python base image FROM python:3.9-slim # Set environment variables to prevent bytecode generation and buffer output for logging ENV PYTHONDONTWRITEBYTECODE=1 ENV PYTHONUNBUFFERED=1 # Install system dependencies RUN apt-get update && apt-get install -y \ gcc \ libgl1-mesa-glx \ libglib2.0-0 \ && rm -rf /var/lib/apt/lists/* # Set the working directory in the container WORKDIR /app # Copy requirements.txt and install Python dependencies COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt RUN pip install accelerate COPY model /app/model # Copy the application code into the container COPY . . # Expose the port your application will run on EXPOSE 7860 # Define the command to run your FastAPI application CMD ["python", "app.py"]