forked from AIDC-AI/Pixelle-Video
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
123 lines (117 loc) Β· 3.83 KB
/
docker-compose.yml
File metadata and controls
123 lines (117 loc) Β· 3.83 KB
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
version: '3.8'
# Build Arguments Configuration
# You can override these by setting environment variables before running docker-compose
#
# Example for China environment (auto uses Tsinghua mirror):
# USE_CN_MIRROR=true docker-compose up -d
#
# Example for international environment (default):
# docker-compose up -d
services:
# Init Service - Ensures config.yaml exists before other services start
# This fixes the Docker issue where mounting a non-existent file creates a directory
init:
image: alpine:latest
volumes:
- ./:/workspace
command: >
sh -c '
if [ -d /workspace/config.yaml ]; then
echo "β οΈ config.yaml is a directory, removing it...";
rm -rf /workspace/config.yaml;
fi;
if [ ! -f /workspace/config.yaml ] && [ -f /workspace/config.example.yaml ]; then
echo "π Creating config.yaml from config.example.yaml...";
cp /workspace/config.example.yaml /workspace/config.yaml;
echo "β
config.yaml created successfully!";
else
echo "β
config.yaml already exists.";
fi
'
restart: "no"
# API Service - FastAPI backend
api:
build:
context: .
dockerfile: Dockerfile
args:
USE_CN_MIRROR: ${USE_CN_MIRROR:-false}
container_name: pixelle-video-api
command: .venv/bin/python api/app.py --host 0.0.0.0 --port 8000
depends_on:
init:
condition: service_completed_successfully
ports:
- "8000:8000"
volumes:
# Mount config file (read-write to allow saving from Web UI)
# Note: init service auto-creates config.yaml from config.example.yaml if not exists
- ./config.yaml:/app/config.yaml
# Mount data directories for persistence
# data/ contains: users/, bgm/, templates/, workflows/ (custom resources)
- ./data:/app/data
- ./output:/app/output
# Note: Default resources (bgm/, templates/, workflows/) are baked into the image
# Custom resources in data/* will override defaults
environment:
- TZ=Asia/Shanghai
restart: unless-stopped
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 10s
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
networks:
- pixelle-network
# Web UI Service - Streamlit frontend
web:
build:
context: .
dockerfile: Dockerfile
args:
USE_CN_MIRROR: ${USE_CN_MIRROR:-false}
container_name: pixelle-video-web
command: .venv/bin/streamlit run web/app.py --server.port 8501 --server.address 0.0.0.0
depends_on:
init:
condition: service_completed_successfully
ports:
- "8501:8501"
volumes:
# Mount config file (read-write to allow saving from Web UI)
# Note: init service auto-creates config.yaml from config.example.yaml if not exists
- ./config.yaml:/app/config.yaml
# Mount data directories for persistence
# data/ contains: users/, bgm/, templates/, workflows/ (custom resources)
- ./data:/app/data
- ./output:/app/output
# Note: Default resources (bgm/, templates/, workflows/) are baked into the image
# Custom resources in data/* will override defaults
environment:
- TZ=Asia/Shanghai
- STREAMLIT_SERVER_PORT=8501
- STREAMLIT_SERVER_ADDRESS=0.0.0.0
- STREAMLIT_BROWSER_GATHER_USAGE_STATS=false
restart: unless-stopped
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8501/_stcore/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 15s
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
networks:
- pixelle-network
networks:
pixelle-network:
driver: bridge