# Use an official Python base image | |
FROM python:3.9 | |
# Set environment variables | |
ENV PYTHONUNBUFFERED=1 \ | |
PYTHONDONTWRITEBYTECODE=1 | |
# Install required system libraries for Manim and dependencies | |
RUN apt-get update && apt-get install -y \ | |
ffmpeg \ | |
libcairo2 \ | |
libpango1.0-0 \ | |
libx11-6 \ | |
libgl1-mesa-glx \ | |
xvfb \ | |
pkg-config \ | |
libpango1.0-dev \ | |
libcairo2-dev \ | |
&& apt-get clean | |
# Set the working directory | |
WORKDIR /app | |
# Copy project files | |
COPY . /app | |
# Install Python dependencies | |
RUN pip install --no-cache-dir --upgrade pip | |
COPY requirements.txt . | |
RUN pip install --no-cache-dir -r requirements.txt | |
# Expose the port | |
EXPOSE 7860 | |
# Run the FastAPI server | |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] | |