# # Use an official Python base image | |
# FROM python:3.9 | |
# # Set environment variables | |
# ENV PYTHONUNBUFFERED=1 \ | |
# PYTHONDONTWRITEBYTECODE=1 | |
# RUN pip install importlib-metadata | |
# # 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"] | |
# Use an official Python runtime as a parent image | |
FROM python:3.9-slim | |
# Set the working directory in the container | |
WORKDIR /app | |
# Install system dependencies required for building the Python packages and ffmpeg | |
RUN apt-get update && apt-get install -y \ | |
pkg-config \ | |
libpango1.0-dev \ | |
libcairo2-dev \ | |
libpangocairo-1.0-0 \ | |
gcc \ | |
g++ \ | |
libglib2.0-dev \ | |
ffmpeg \ | |
&& rm -rf /var/lib/apt/lists/* | |
# Upgrade pip to the latest version | |
RUN pip install --upgrade pip | |
# Copy the current directory contents into the container at /app | |
COPY . /app | |
# Install Python dependencies | |
RUN pip install --no-cache-dir -r requirements.txt | |
# Expose the port your app will run on (adjust based on your app's needs) | |
EXPOSE 7860 | |
# Define the command to run your application | |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] | |