File size: 2,910 Bytes
d47b053
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# Docker Compose for ManimCat
# Production-ready with Redis for task queue and state management

version: '3.8'

services:
  redis:
    image: redis:7-alpine
    container_name: manim-redis
    ports:
      - "${REDIS_PORT:-6379}:6379"
    volumes:
      - redis-data:/data
    restart: unless-stopped
    healthcheck:
      test: ["CMD", "redis-cli", "ping"]
      interval: 5s
      timeout: 600s
      retries: 10
      start_period: 5s
    command: redis-server --appendonly yes --maxmemory 256mb --maxmemory-policy allkeys-lru
    networks:
      - manimcat-network

  manimcat:
    build:
      context: .
      dockerfile: Dockerfile
      args:
        - NODE_ENV=production
    image: manimcat:latest
    container_name: manimcat
    ports:
      - "${PORT:-3000}:3000"
    environment:
      - NODE_ENV=production
      - PORT=3000
      - LOG_LEVEL=${LOG_LEVEL:-info}
      - PROD_SUMMARY_LOG_ONLY=${PROD_SUMMARY_LOG_ONLY:-true}
      - HTTP_PROXY=${HTTP_PROXY:-}
      - HTTPS_PROXY=${HTTPS_PROXY:-}
      - NO_PROXY=${NO_PROXY:-}
      - http_proxy=${http_proxy:-}
      - https_proxy=${https_proxy:-}
      - no_proxy=${no_proxy:-}
      - REDIS_HOST=redis
      - REDIS_PORT=6379
      - REDIS_DB=${REDIS_DB:-0}
      # Upstream routing (required for server-side generation unless frontend passes customApiConfig)
      - MANIMCAT_ROUTE_KEYS=${MANIMCAT_ROUTE_KEYS:-}
      - MANIMCAT_ROUTE_API_URLS=${MANIMCAT_ROUTE_API_URLS:-}
      - MANIMCAT_ROUTE_API_KEYS=${MANIMCAT_ROUTE_API_KEYS:-}
      - MANIMCAT_ROUTE_MODELS=${MANIMCAT_ROUTE_MODELS:-}
      - DISPLAY=:99
    volumes:
      # Persist studio workspace sessions, generated code, and studio outputs
      - studio-workspace-data:/app/.studio-workspace
      # Persist generated images and uploaded reference images
      - image-storage:/app/public/images
      # Persist generated videos
      - video-storage:/app/public/videos
      # Persist Manim media cache and intermediate render artifacts
      - manim-media:/app/media
      # Temp directory for rendering
      - manim-tmp:/app/tmp
    depends_on:
      redis:
        condition: service_healthy
    restart: unless-stopped
    healthcheck:
      test: ["CMD-SHELL", "node -e \"require('http').get('http://localhost:3000/health', (r) => process.exit(r.statusCode === 200 ? 0 : 1))\""]
      interval: 30s
      timeout: 600s
      retries: 3
      start_period: 40s
    networks:
      - manimcat-network
    # Resource limits (adjust based on your needs)
    deploy:
      resources:
        limits:
          cpus: '2'
          memory: 4G
        reservations:
          cpus: '1'
          memory: 2G

networks:
  manimcat-network:
    driver: bridge

volumes:
  studio-workspace-data:
    driver: local
  image-storage:
    driver: local
  manim-tmp:
    driver: local
  manim-media:
    driver: local
  redis-data:
    driver: local
  video-storage:
    driver: local