Spaces:
Running
Running
File size: 1,442 Bytes
b684a16 4f31e9e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
FROM python:3.12-slim
# Install all dependencies in one layer
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc \
libffi-dev \
curl \
ca-certificates \
python3-dev \
pkg-config \
libcairo2-dev \
libpango1.0-dev \
ffmpeg \
texlive-full \
dvisvgm \
fonts-dejavu \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
&& which dvisvgm
WORKDIR /app
# Install uv for faster pip operations
ADD https://astral.sh/uv/install.sh /uv-installer.sh
RUN sh /uv-installer.sh && rm /uv-installer.sh
ENV PATH="/root/.local/bin:${PATH}"
# Copy virtual environment and project files
COPY requirements.txt .
# Activate the existing venv and install any missing packages
RUN uv venv /app/manimations \
&& . /app/manimations/bin/activate \
&& uv pip install --no-cache -r requirements.txt \
&& uv pip install --no-cache pycairo pangocffi manim
ENV PATH="/app/manimations/bin:${PATH}"
COPY *.py /app/
# Set environment variables
ENV PYTHONPATH=/app
ENV MPLBACKEND=Agg
ENV GRADIO_SERVER_NAME=0.0.0.0
ENV GRADIO_SERVER_PORT=7860
# Create directory for generated videos
RUN mkdir -p /app/generated_videos
# Copy .env file
COPY .env /app/.env
# Expose the port for the Gradio interface
EXPOSE 7860
# Command to run the application with the virtual environment
CMD ["/app/manimations/bin/python", "ai_agent.py"] |