File size: 1,776 Bytes
fff13d1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
57
58
59
60
61
62
63
64
65
66
67
68
# Blaxel Sandbox Dockerfile for Manim + FFmpeg
# This creates a custom sandbox image with all dependencies pre-installed

FROM python:3.12-slim

# Set working directory
WORKDIR /app

# Copy sandbox API (required for Blaxel sandboxes)
COPY --from=ghcr.io/blaxel-ai/sandbox:latest /sandbox-api /usr/local/bin/sandbox-api

# Install system dependencies including FFmpeg, LaTeX, and build tools
RUN apt-get update && apt-get install -y --no-install-recommends \
    # Core utilities
    curl \
    ca-certificates \
    netcat-openbsd \
    git \
    build-essential \
    # FFmpeg and media processing
    ffmpeg \
    # LaTeX for Manim (optional but recommended)
    texlive \
    texlive-latex-extra \
    texlive-fonts-extra \
    texlive-latex-recommended \
    texlive-science \
    texlive-fonts-recommended \
    # Manim system dependencies
    libcairo2-dev \
    libpango1.0-dev \
    pkg-config \
    python3-dev \
    # Additional utilities
    sox \
    libsox-fmt-mp3 \
    && rm -rf /var/lib/apt/lists/*

# Upgrade pip and install uv for faster package management
RUN pip install --no-cache-dir --upgrade pip setuptools wheel \
    && pip install --no-cache-dir uv

# Install Manim and core Python dependencies
RUN pip install --no-cache-dir \
    manim>=0.18.1 \
    numpy>=1.24.0 \
    Pillow>=10.0.0 \
    scipy \
    && pip cache purge

# Verify installations
RUN python3 -c "import manim; print(f'Manim version: {manim.__version__}')" \
    && ffmpeg -version \
    && echo "All dependencies installed successfully!"

# Create media output directory
RUN mkdir -p /tmp/media

# Copy and set up entrypoint script
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh

# Expose sandbox API port
EXPOSE 8080

# Set entrypoint
ENTRYPOINT ["/entrypoint.sh"]