1+ # Docker Compose for Video Subtitle Generator
2+ # Using modern Compose specification with latest best practices
3+
4+ name : video-subtitle-generator
5+
6+ services :
7+ subtitle-generator :
8+ build :
9+ context : .
10+ dockerfile : Dockerfile
11+ tags :
12+ - video-subtitle-generator:latest
13+ - video-subtitle-generator:${VERSION:-latest}
14+ image : video-subtitle-generator:latest
15+ container_name : video-subtitle-generator
16+ restart : unless-stopped
17+
18+ environment :
19+ # Application settings
20+ LOG_LEVEL : INFO
21+ PYTHONUNBUFFERED : " 1"
22+ ENV : production
23+
24+ # Google Cloud settings (optional - can use service account file instead)
25+ # GOOGLE_APPLICATION_CREDENTIALS: /app/service-account.json
26+ # GCP_PROJECT_ID: your-project-id
27+
28+ volumes :
29+ # Input/Output directories - map to your local directories
30+ - type : bind
31+ source : ./data/input
32+ target : /data/input
33+ read_only : false
34+ - type : bind
35+ source : ./data/output
36+ target : /data/output
37+ read_only : false
38+ - type : bind
39+ source : ./data/logs
40+ target : /data/logs
41+ read_only : false
42+ - type : bind
43+ source : ./data/temp
44+ target : /data/temp
45+ read_only : false
46+ - type : bind
47+ source : ./data/jobs
48+ target : /data/jobs
49+ read_only : false
50+
51+ # Configuration and credentials
52+ - type : bind
53+ source : ./data/config
54+ target : /data/config
55+ read_only : true
56+
57+ # Optional: Mount local development code for hot reload
58+ # - type: bind
59+ # source: ./src
60+ # target: /app/src
61+ # read_only: true
62+
63+ ports :
64+ # Web interface port (if implemented)
65+ - target : 8080
66+ published : 8080
67+ protocol : tcp
68+ mode : host
69+
70+ # Resource limits for production
71+ deploy :
72+ resources :
73+ limits :
74+ memory : 8G
75+ cpus : ' 4'
76+ reservations :
77+ memory : 2G
78+ cpus : ' 1'
79+
80+ # Health check
81+ healthcheck :
82+ test :
83+ - CMD
84+ - python
85+ - -c
86+ - " from src.health_checker import quick_health_check; h=quick_health_check(); exit(0 if h['overall_status'] in ['healthy','warning'] else 1)"
87+ interval : 30s
88+ timeout : 10s
89+ retries : 3
90+ start_period : 60s
91+ start_interval : 5s
92+
93+ # Run in interactive mode by default
94+ stdin_open : true
95+ tty : true
96+
97+ # Security settings
98+ security_opt :
99+ - no-new-privileges:true
100+ cap_drop :
101+ - ALL
102+ cap_add :
103+ - CHOWN
104+ - SETUID
105+ - SETGID
106+
107+ # Override command examples:
108+ # command: ["python", "main.py", "--help"]
109+ # command: ["python", "main.py", "--video", "/data/input/video.mp4", "--languages", "eng,hin"]
110+ # command: ["python", "main.py", "--batch", "/data/input"]
111+
112+ # Optional: Add monitoring stack
113+ prometheus :
114+ image : prom/prometheus:v2.47.2
115+ container_name : subtitle-prometheus
116+ ports :
117+ - target : 9090
118+ published : 9090
119+ protocol : tcp
120+ mode : host
121+ volumes :
122+ - type : bind
123+ source : ./monitoring/prometheus.yml
124+ target : /etc/prometheus/prometheus.yml
125+ read_only : true
126+ - type : volume
127+ source : prometheus_data
128+ target : /prometheus
129+ command :
130+ - --config.file=/etc/prometheus/prometheus.yml
131+ - --storage.tsdb.path=/prometheus
132+ - --storage.tsdb.retention.time=30d
133+ - --web.console.libraries=/etc/prometheus/console_libraries
134+ - --web.console.templates=/etc/prometheus/consoles
135+ profiles :
136+ - monitoring
137+ security_opt :
138+ - no-new-privileges:true
139+ user : " 65534:65534"
140+ restart : unless-stopped
141+
142+ grafana :
143+ image : grafana/grafana:10.2.0
144+ container_name : subtitle-grafana
145+ ports :
146+ - target : 3000
147+ published : 3000
148+ protocol : tcp
149+ mode : host
150+ environment :
151+ GF_SECURITY_ADMIN_PASSWORD : admin
152+ GF_USERS_ALLOW_SIGN_UP : " false"
153+ GF_SECURITY_DISABLE_GRAVATAR : " true"
154+ GF_USERS_DEFAULT_THEME : light
155+ GF_LOG_LEVEL : warn
156+ volumes :
157+ - type : volume
158+ source : grafana_data
159+ target : /var/lib/grafana
160+ - type : bind
161+ source : ./monitoring/grafana/dashboards
162+ target : /etc/grafana/provisioning/dashboards
163+ read_only : true
164+ - type : bind
165+ source : ./monitoring/grafana/datasources
166+ target : /etc/grafana/provisioning/datasources
167+ read_only : true
168+ depends_on :
169+ prometheus :
170+ condition : service_healthy
171+ restart : true
172+ profiles :
173+ - monitoring
174+ security_opt :
175+ - no-new-privileges:true
176+ user : " 472:472"
177+ restart : unless-stopped
178+ healthcheck :
179+ test :
180+ - CMD-SHELL
181+ - " curl -f http://localhost:3000/api/health || exit 1"
182+ interval : 30s
183+ timeout : 10s
184+ retries : 3
185+ start_period : 40s
186+
187+ volumes :
188+ prometheus_data :
189+ driver : local
190+ driver_opts :
191+ type : none
192+ o : bind
193+ device : ./data/monitoring/prometheus
194+ grafana_data :
195+ driver : local
196+ driver_opts :
197+ type : none
198+ o : bind
199+ device : ./data/monitoring/grafana
200+
201+ networks :
202+ default :
203+ name : subtitle-generator-network
204+ driver : bridge
205+ ipam :
206+ config :
207+ - subnet : 172.20.0.0/16
0 commit comments